has

?? [h?z]

v.Have(have? 3?? ??) take; buy

class

English [klɑ:s ]美[kl?s]

n.class; grade; adj.?? ??, ???, ???

vi.... ????(?? ??)? ??, ?? ????(?? ??)? ???

jquery hasClass() ??? ???

??: hasClass() ???? ??? ??? ??? ???? ???? ??? ?????.

??: ??$(selector).hasClass(class)

????:

ParametersDescription
class ?????. ??? ???? ?? ???? ?????.

jquery hasClass() ??? ?

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    alert($("p:first").hasClass("intro"));
  });
});
</script>
<style type="text/css">
.intro
{
font-size:120%;
color:red;
}
</style>
</head>

<body>
<h1 id="h1">This is a heading</h1>
<p class="intro">This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>檢查第一個段落是否擁有類 "intro"</button>
</body>
</html>
???? ?? ?

??? ????? ??? "???? ??" ??? ?????