jquery事件操作之on
时间:7年前 阅读:6370
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#hd{
width: 500px;
height: 300px;
background: darkcyan;
}
</style>
<script src="../js/jquery-1.11.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
// $('#hd').click(function(){
// alert('这个是单击事件')
// })
// $('#hd').mouseenter(function(){
// alert('这个是移入事件');
// })
// 两个事件可以通过on一起绑定
$('#hd').on('click mouseenter',function(){
alert('移入和点击能促发这个')
})
// 删除事件 把上面两个事件中的mouseenter事件删除
$('#hd').off('mouseenter');
})
</script>
</head>
<body>
<div id="hd">
</div>
</body>
</html>
本站声明:网站内容来源于网络,如有侵权,请联系我们https://www.qiquanji.com,我们将及时处理。
微信扫码关注
更新实时通知


网友评论