13-jquery 绑定事件、解绑
<html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="js/jquery.js"></script> <script> $(function(){ /* 这种写法只能绑定一个事件 $("#btn").click(function(){ ... }) */ //用bind可以绑定多个事件 $("#btn").bind('click mouseover',function(){ alert("click和mouseover都能触发我") //unbind解绑,将绑定的事件解绑 $(this).unbind('mouseover') }) }) </script> </head> <body> <input type="button" value="button" id="btn"> </body> </html>

浙公网安备 33010602011771号