The basic selector is the most commonly used selector in jquery and the simplest selector, which finds DOM elements through element Id,class and tag names (only once in a Web page, and class allows for reuse).
1,#idusage: $ ("#myDiv"); returns a collection of values that comprise a single element
Description: This is the direct selection of HTML in the id= "Mydiv"
2,Elementusage: $ ("div")return value Collection element
Note: The English translation of element is "elemental", so element is actually a tag element that is already defined in HTML, such as Div,input, A, and so on.
3,classusage: $ (". MyClass")return value Collection element
Note: This tag is a direct selection of elements or groups of elements in the HTML code that class= "MyClass" (because class can have more than one value in the same HTML page).
4, * usage:$ ("*")return value Collection element
Description: Matches all elements and is used in conjunction with context to search
5,Selector1, Selector2, Selectornusage:$ ("Div,span,p.myclass")return value Collection element
Description: Merges the elements that match each selector to return together. You can specify any number of selectors and merge the matched elements into one result. Where p.myclass is a matching element
Pclass= "MyClass"
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Black Horse DAY16 jquery basic Selector