Blogger Information
Blog 7
fans 0
comment 0
visits 5092
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
jQuery中的事件注册与删除: on()和off()方法的使用
phpcn_u68463的博客
Original
531 people have browsed it

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>

<style type="text/css">

div{

width: 200px;height: 200px;background: red;

}

</style>

</head>

<body>

<div id=""></div>

</body>

</html>

2017-12-24_192928.png

<script type="text/javascript">

$('div').on('click',function(){

// $(this).css('background','blueviolet')

// $(this)[0].style.background = 'yellow'

$(this).get(0).style.background = 'yellow'

}).on('mouseenter',function(){

alert(555)

}).on('mouseleave',function(){

alert(888)

})


$('div').off('mouseenter')

</script>



Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!