Home  >  Article  >  Web Front-end  >  JQuery Study Notes Selector 5_jquery

JQuery Study Notes Selector 5_jquery

WBOY
WBOYOriginal
2016-05-16 18:49:241306browse
Copy code The code is as follows:







Untitled Document


Reset
div1


div3

div4
div5


Set all DIVs on the page Element's background color|
Set the background color of the second DIV|
Set the background color of DIVs except the second DIV|
Set the name attribute value to Elements starting with DIV|
Set the name attribute value Elements ending with ly|
Set the element whose name attribute value contains th|
Comprehensive application





1.$("selector [Attribute]")--Note, the following is directly abbreviated as [Attribute]
Description: Get the set of elements with the Attribute attribute in the set of elements selected by the selector. It should be relatively simple, so I won’t explain it in detail here. If you don’t understand, please post it below.
Return value: Array(Element);
2.[attribute=value]
Description: Get In the set of elements selected by the selector, the set of elements with an Attribute attribute value equal to Value.
Return value: Array(Element);
3.[attribute!=value]
Description: Get the set of elements whose Attribute attribute value is not equal to Value in the set of elements selected by the selector.
Return value: Array(Element);
4.[attribute^=value]
Description: Get the set of elements whose Attribute attribute value starts with Value in the set of elements selected by the selector. Equivalent to the regular specification ^^
Return value: Array(Element);
5.[attribute$=value]
Description: Get the Attribute attribute value ending with Value in the set of elements selected by the selector Collection of elements. Equivalent to the regular specification ^^
Return value: Array(Element);
6.[attribute*=value]
Description: Get the elements whose Attribute attribute value contains Value in the set of elements selected by the selector. gather.
Return value: Array(Element);
7.[selector1][selector2][selectorN]
Description: Same as the comprehensive application of basic selectors in Chapter 1, this method is also the first 6 The comprehensive version, just like in my example $("div[id][name !=Fifthly][name *= i]") is to take all div elements that have ID attributes&&name attributes!=Fifthly&&name attributes that contain the character i A collection of DIV elements. If you try it with my example, you will be able to clearly understand and see the effect, haha. It should be useful to make good use of this method^^
Return value: Array(Element);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn