Is the class
Description
The following code shows how to check if the selected has the class.
Example
<html>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {<!-- w w w .j a v a2s .c om-->
$("div").one('click', function() {
if ($(this).is(".blue,.red")) {
$("p").text("It's the blue and red div.");
} else {
$("p").text("It's NOT the blue and red div.");
}
$("p").hide().slideDown("slow");
});
});
</script>
</head>
<body>
<body>
Press each to see the text.
<div class=blue>java2s.com</div>
<div class=red>java2s.com</div>
<div>java2s.com</div>
<div>java2s.com</div>
<div>java2s.com</div>
<div>java2s.com</div>
<p></p>
</body>
</html>