JQuery Learning Note Selector Five _jquery

Source: Internet
Author: User
Copy Code code as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<script src= "Js/jquery-1.3.2.js" ></script>
<script type= "Text/javascript" ><!--
$ (function () {
$ ("#aFirst"). Click (function () {
$ ("Div[id]"). each (function () {
$ (this). CSS ("Background", "#773300");
})
})
$ ("#aSecond"). Click (function () {
$ ("Div[id = Div2]"). each (function () {
$ (this). CSS ("Background", "#8833ff");
})
})
$ ("#aThird"). Click (function () {
$ ("Div[id!= Div2]"). each (function () {
$ (this). CSS ("Background", "#87f289");
})
})
$ ("#aFourthly"). Click (function () {
$ ("Div[name ^= div]"). each (function () {
$ (this). CSS ("Background", "#140586");
})
})
$ ("#aFifthly"). Click (function () {
$ ("Div[name $= ly]"). each (function () {
$ (this). CSS ("Background", "#930584");
})
})
$ ("#aSixth"). Click (function () {
$ ("div[name *= th]"). each (function () {
$ (this). CSS ("Background", "#099483");
})
})
$ ("#aSeventh"). Click (function () {
$ ("Div[id][name!=fifthly][name *= i]"). each (function () {
$ (this). CSS ("Background", "#938607");
})
})
})
--></script>
<title> Untitled Document </title>
<body>
<a href= "#" onclick= "Javascript:location.reload ();" > Reset </a>
<div id= "DIV1" name = "Div_first" >div1</div>
<div id= "div2" name = "Div_second" >div2</div>
<div id= "div3" name = "Div_third" >div3</div>
<div id= "div4" name = "Div_fourthly" >div4</div>
<div id= "DIV5" name= "fifthly" >div5</div>

<a href= "#" id= "Afirst" > Set the background color of all DIV elements on the page </a>|
<a href= "#" id= "Asecond" > Set the background color of the 2nd Div </a>|
<a href= "#" id= "Athird" > Set the background color of the div except for the 2nd Div </a>|
<a href= "#" id= "afourthly" > set the element whose Name property value begins with a div </a>|
<a href= "#" id= "afifthly" > sets the element with the Name property value at the end of Ly, </a>|
<a href= "#" id= "Asixth" > Setting the Name property value contains th element </a>|
<a href= "#" id= "Aseventh" > Integrated Application </a>

</body>

1.$ ("selector [attribute]")--note, the following directly abbreviated as [attribute]
Description: Gets the collection of elements that have attribute attributes in the collection of elements selected by selector. Should be simpler, in this do not do what detailed instructions, there are not understand with the next post, ha
return value: Array (Element);
2.[attribute=value]
Description: Gets the collection of elements in the selector selection that has the attribute value equal to value.
return value: Array (Element);
3.[attribute!=value]
Description: Gets the collection of elements in the selector selection that has an attribute value that is not equal to value.
return value: Array (Element);
4.[attribute^=value]
Description: Gets the collection of elements in the selected selector element, with the attribute property value starting with values. Equivalent to regular norm ^ ^
return value: Array (Element);
5.[attribute$=value]
Description: Gets the collection of elements in the selector selection that has the attribute property value ending at value. Equivalent to regular norm ^ ^
return value: Array (Element);
6.[attribute*=value]
Description: Gets the collection of elements in the selector selected element collection that has the attribute property value containing values.
return value: Array (Element);
7.[selector1][selector2][selectorn]
Description: As in the first chapter, the basic selector is integrated, this method is the first 6 kinds of comprehensive version, as in my example $ ("Div[id][name!=fifthly][name *= i]") is to take all the DIV elements, with ID attributes && The Name property!=fifthly&&name property contains a collection of DIV elements for the character I, and you can use my example to get a good idea of what you see, ha. Good use of this method should be useful ^ ^
return value: Array (Element);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.