filter () and not ():
Copy Code code as follows:
<script type= "Text/javascript" >
$ (document). Ready (function () {
Output Hello
Alert ($ ("P"). Filter (". Selected"). html ());
Output how are?
Alert ($ ("P"). Not (". Selected"). html ());
});
</script>
<body>
<p class= "selected" >hello</p><p>how are you?</p>
<!--
A new challenge is to select only one particular element from a group of similar or identical elements.
jquery provides filter () and not () to do this.
Filter () is able to streamline the elements to only those that satisfy the filter conditions, not () instead, he removes all the conditions that satisfy the condition. -->
</body>
Split ():
Copy Code code as follows:
<script type= "Text/javascript" >
$ (document). Ready (function () { br>$ ("input[@value =btn1]"). Click (function () {
//¥ split
Alert ($ ("Span.sale"). Text (). Split ("¥") [2]+ "| |" +$ ("Span.sale"). Text (). Split ("¥") [1]+] +$ ("Span.sale"). Text (). Split ("¥") [0]);
});
});
</script>
<body>
Get price 120:<input type= "button" value= "BTN1" ><BR&G T
<span class= "Sale" >
out sale:¥160<br/>
Deal price:¥120</span>
<!--
Apply S Plit to solve the problem. Here is an example of split:
msg = "2007/10/01";
msg = Msg.split ("/");
Alert (msg[2]);
He will divide the msg into 3 pieces to form an array, and then you can easily get it.
-->
</body>