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 "/>
<title> Untitled Document </title>
<script src= "Js/jquery-1.3.2.js" ></script>
<script type= "Text/javascript" ><!--
$ (function () {
$ ("#aFirst"). Click (function () {
$ ("#Result"). HTML ("");
$ ("#Result"). HTML ($ ("Ul:first"). html ());
})
$ ("#aLast"). Click (function () {
$ ("#Result"). HTML ("");
$ ("#Result"). HTML ($ ("Ul:last"). html ());
})
$ ("#aNot"). Click (function () {
$ ("#Result"). HTML ("");
$ ("#Result"). HTML ($ ("Input:not (: Checked)"). attr ("id"));
})
$ ("#aEven"). Click (function () {
$ ("#Result"). HTML ("");
$ ("Ul:even"). each (function () {
$ ("#Result"). HTML ($ ("#Result"). HTML () + $ (this). html ());
})
})
$ ("#aOdd"). Click (function () {
$ ("#Result"). HTML ("");
$ ("ul:odd"). each (function () {
$ ("#Result"). HTML ($ ("#Result"). HTML () + $ (this). html ());
})
})
$ ("#aEq"). Click (function () {
$ ("#Result"). HTML ("");
$ ("Ul:eq (3)"). each (function () {
$ ("#Result"). HTML ($ ("#Result"). HTML () + $ (this). html ());
})
})
$ ("#aGt"). Click (function () {
$ ("#Result"). HTML ("");
$ ("UL:GT (3)"). each (function () {
$ ("#Result"). HTML ($ ("#Result"). HTML () + $ (this). html ());
})
})
$ ("#aLt"). Click (function () {
$ ("#Result"). HTML ("");
$ ("Ul:lt (3)"). each (function () {
$ ("#Result"). HTML ($ ("#Result"). HTML () + $ (this). html ());
})
})
$ ("#aHeader"). Click (function () {
$ ("#Result"). HTML ("");
$ (": Header"). each (function () {
$ ("#Result"). HTML ($ ("#Result"). HTML () + $ (this). html ());
})
})
})
--></script>
<body>
<div>
<li>li1
<ul>1</ul>
<ul>2</ul>
<ul>3</ul>
<ul>4</ul>
</li>
<li>li2
<ul>5</ul>
<ul>6</ul>
</li>
<li>li3
</li>
</div>
<input type= "checkbox" id= "CheckBox1"/>checkbox1
<input name= "Flower" type= "checkbox" id= "CheckBox2" checked= "checked"/>checkbox2
<br/>
<a href= "#" id= "Afirst" > Display the value of the first UL node </a>
<a href= "#" id= "Alast" > Display the value of the last UL node </a>
<a href= "#" id= "Anot" > Show id</a> of checkbox not selected
<a href= "#" id= "Aeven" > Display index as even UL content </a>
<a href= "#" id= "AODD" > Display index as odd ul content </a>
<a href= "#" id= "Aeq" > Display index 3 UL content </a>
<a href= "#" id= "aGt" > Display index greater than 3 UL content </a>
<a href= "#" id= "aLt" > Display index less than 3 UL content </a>
<a href= "#" id= "Aheader" > Display page title content </a>
<br/>
Result:
<br/>
<div id= "Result" >
</div>
</body>
This section does not seem to have any extracurricular knowledge point, ha, that now enters the topic slightly
1.$ ("Tabname:first")
Description: Can get a node of the first node, such as the example of 6 UL, using $ ("Ul:first") to obtain the first UL node
return value: Element;
2.$ ("Tabname:last")
Description: Similar to previous usage, except that this method is used to get the last node
return value: Element;
3.$ ("Tabname:not (attribute)")
Description: This method enables some simple selector filtering, as in the example, $ ("Input:not (: Checked)") selects the checkbox element that is not selected, and this method is still in practice, as if it can only filter for attributes that have a value of bool. The example is equivalent to selecting checked to false input.
return value: Array (Element);
4.$ ("Tabname:even")
Description: Used to get a set of even index nodes of a node, here to emphasize that the index here is starting from 0 so the example of Aeven click after the acquisition of the 1th, 3, 5 of the UL node
return value: Array (Element);
5.$ ("Tagname:odd")
Description: Like the previous method, the only difference is that this gets a collection of odd-numbered nodes.
return value: Array (Element);
6.$ ("Tagname:eq (Index)")
Description: The node used to get the index position in a node collection
return value: Array (Element);
7.$ ("TAGNAME:GT (Index)")
Description: Used to get a collection of nodes in a node collection with an index greater than index
return value: Array (Element);
8.$ ("Tagname:lt (Index)")
Description: Used to get a collection of nodes in a node collection with an index less than index
return value: Array (Element);
9.$ (": Header")
Description: Used to get a collection of header nodes such as H1, H2, H3 in the page
return value: Array (Element);