04
2018
11

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

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

微信扫码关注

更新实时通知

« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。