jquery事件操作之on

时间:5年前   阅读:4319

<!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,我们将及时处理。

微信扫码关注

更新实时通知

上一篇:硬核避险资产黄金创新高,资产配置框架下黄金不可或缺

下一篇:50ETF期权“永不爆仓”,真的吗?

网友评论

请先 登录 再评论,若不是会员请先 注册