Selector Reference
Next ❯Traversing Reference
Selectors are being used to select elements, you want to do some action on it
| Selectors | Used |
|---|---|
| * | To select all elements |
| element | To select specific type of elements |
| this | To select current element, only used inside events |
| #idName | To select element with a specific 'id' name |
| .className | To select all elements with a specific 'class' name |
| .className.classNameN | To select all elements with a specific 'multiclass' names |
| element, element | To select all specific group of elements |
| document | To select the document, only used with events |
| window | To select the window, only used with events |
| descendant selector [space] | To select all specific child, grand-child, grand-grandchild and so on, of a specified element |
| child selector [>] | To select all specific direct child of a specified element |
| adjacent sibling selector [+] | To select all elements that are placed immediately after a specified element |
| general sibling selector [~] | To select all elements that are siblings (sharing same parent) of a specified element |
| [attribute] | To select all elements having specified attribute |
| [attribute="value"] | To select all elements having specified attribute with specified value |
| [attribute!="value"] | To select all elements not having specified attribute with specified value |
| [attribute|="value"] | To select all elements having specified attribute with specified value equal to or followed by a hyphen(-) |
| [attribute~="value"] | To select all elements having specified attribute containing a specified value |
| [attribute^="value"] | To select all elements having specified attribute begins with specified value |
| [attribute$="value"] | To select all elements having specified attribute ends with specified value |
| [attribute*="value"] | To select all elements having specified attribute which contains substring as specified value |
| :animated | To select currently animated element (animation only via animate() function) |
| :button | To select input elements with type="button" |
| :checkbox | To select input elements with type="checkbox" |
| :checked | To select checked input element |
| :disabled | To select disabled element |
| :empty | To select element that has no children & no text |
| :enabled | To select enabled element |
| :even | To select even index element |
| :file | To select input elements with type="file" |
| :first | To select the first element |
| :focus | To select input element that has focus |
| :header | To select only the header(<h1> - <h6>) element |
| :hidden | To select the hidden element |
| :image | To select input elements with type="image" |
| :input | To select input elements |
| :last | To select the last element |
| :odd | To select odd index element |
| :parent | To select element that have at least one child (either an element or text) |
| :password | To select input elements with type="password" |
| :radio | To select input elements with type="radio" |
| :reset | To select input elements with type="reset" |
| :root | To select the document's root element |
| :submit | To select input elements with type="submit" |
| :text | To select input elements with type="text" |
| :visible | To select the visible element |
| :contains(text) | To select element containing specific text |
| :eq(index) | To select sepcific index element |
| :gt(index) | To select elements with value greater then specific index |
| :has(sp_selector) | To select element having specific-selector as child |
| :lang(language) | To select element with a "lang" attribute with specified value |
| :lt(index) | To select elements with value lesser then specific index |
| :not(sp_selector) | To select element which is not having specific-selector |
| :first-child | To select element that are the first child of its parent |
| :first-of-type | To select element that are the first of its type, of its parent |
| :last-child | To select element that are the last child of its parent |
| :last-of-type | To select element that are the last of its type, of its parent |
| :only-child | To select element that are the only child of its parent |
| :only-of-type | To select element that are the only child of its type, of its parent |
| :nth-child(n) | To select element that are the nth child of its parent |
| :nth-of-type(n) | To select element that are the nth child of its type, of its parent |
| :nth-last-child(n) | To select element that are the nth child of its parent from last |
| :nth-last-of-type(n) | To select element that are the nth child of its type, of its parent from last |
❮ Prev Extra Methods
Next ❯Traversing Reference






So,