(048)jquery_事件_unbind
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>dom_unbind.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <style type="text/css"> div { width: 160px; border: solid 1px #ccc; padding: 8px; text-align: center; } .color { color: orange; } .backcolor { background-color: orange; color: white; } </style> <script type="text/javascript" src="../js/jquery/jquery190.js"></script> <script type="text/javascript"> $(function(){ $("div").bind("click",function(){ $(this).removeClass("color").addClass("backcolor"); }).bind("dblclick",function(){ $(this).removeClass("backcolor").addClass("color"); }); $("#btntest").click(function(){ $("div").unbind("dblclick"); $(this).attr("disabled","true"); }); }); </script> </head> <body> <h3>unbind()移除绑定的事件</h3> <input id="btntest" type="button" value="移除事件" /> <div>土豪,咱们交个朋友吧</div> </body> </html>
***万事万物都有裂痕,那是光照进来的地方***

浙公网安备 33010602011771号