jQuery provides the is() method to easily determine whether an element is visible, hidden, and selected.
In jquery, you can use xx.is(':checked') to determine whether checkbox and radiobutton are selected. Test html as follows
is function introduction< /title>
//Note that jQuery is used here Official script library
//Note that the first div appears here
//Note that the second div appears here
//Note that the third div appears here
//Note that the fourth div appears here
Peter
//Note that the fifth div appears here
//Note that the 6th div appears here
<script><br> $("div").one('click', function () { //$("div").one represents attaching an event to the div element, <br>//You can also attach multiple events, such as click or mouseout to execute something at the same time <br> if ($(this ).is(":first-child")) { //is function comes into play, is(":first-child") represents <br> //Judge whether this div is the first div to appear<br> $ ("p").text("It's the first div."); //The difference between text and html is whether it supports html tags <br> // If you write an alert in it at this time, it will not be executed <br> } else if ($(this).is(".blue,.red")) { //Determine whether the div has a blue or red class<br> $("p").text("This is blue or red Red div");<br> } else if ($(this).is(":contains('Peter')")) { //Determine whether the word Peter exists in the div<br> $("p" ).text("It's Peter!");<br> } else {<br> } $("p").html("It's nothing <em>special</em>.");<br> }<br> $("p").hide().slideDown("slow"); //This is an animation effect that slowly displays the content of p<br> $(this).css({"border-style" : "inset", cursor:"default"});<br> });<br></script>