The attribute selectors in jquery are: 1. ID selector; 2. CSS selector; 3. Label selector; 4. Hierarchical selector; 5. Filter selector; 6. Attribute selector; 7. Child element selector; 8. Form selector.
Using the $() symbol as a selector in jQuery greatly improves work efficiency.
(Learning video sharing: javascript video tutorial)
Commonly used attribute selectors include the following:
1) $('#id') id selector
##19) $('li[title*=k]') Attribute Selector, selects all elements with the word k in all titles in li;
20) $('li:first-child') Child element filter;:first filter The device can get the first child element of the specified parent element, not a collection. It is just the first child element under a li, not all the child elements under li. And first-child gets the first child element returned by each parent element;
21) $('li:last-child') Like the above filter selector, last:child will get the last child element returned by each parent element;
22) $('form :input') The form selector includes input, select, button, textarea,
23) $(' form :text') Form text selector, this selector only contains type selection
24) $('form :password') The form password selector also only contains the type='password' type in the input,
25) $('form :radio') The radio button selector also only contains type='radio' type in input, 26) $('form:checkbox') checkbox selector, also only contains type='checkbox' type in input
27 ) $('form :submit') Submit button selector, including input type="submit" and button type,
28) $('form :image') Image field Selector. Only the src in the input can take effect. If img src is added to the form, it will not be affected
29) $('form :button') Form button selector. Includes type='button' and < button>valid
30) $('form :checked') Select the state selector, with the selection box radio and checkbox will be selected;
31) $('form :selected') When the selector is selected in the drop-down box, only the option selectors that are selected in the select drop-down list can be obtained;
Related recommendations: js tutorial
The above is the detailed content of What attribute selectors does jquery have?. For more information, please follow other related articles on the PHP Chinese website!