点击.box跟点击.box.box1
2016-12-02 14:58 改吧 阅读(500) 评论(3) 收藏 举报<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>click</title>
<script type="text/javascript" src='jquery-2.2.0.min.js'></script>
<style type="text/css">
div{
width:200px;
height:200px;
background-color:red;
}
</style>
</head>
<body>
<div class='box'>
hello
</div>
<div class='box box1'>
hello
</div>
</body>
<script type="text/javascript">
$('.box').click(function(){
alert(1111);
})
$('.box.box1').click(function(){
alert(3333)
})
</script>
</html>
点击.box会出现1111
点击.box.box1的时候出现1111 3333弹出两次
浙公网安备 33010602011771号