jquery事件操作之on
<!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/post/7464.html
本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。

