jQueryイベントバインドとバインド解除の実装方法

1296 ワード

この例では、jQueryイベントバインドとバインド解除の実装方法について説明します.皆さんの参考にしてください.具体的には以下の通りです.




 New Document 





 
2
3
4
5
6
7
8
jQuery(function(){ jQuery("div").bind('click',function(){ if(jQuery(this).attr('class') != ''){ return false; } jQuery(this).addClass("has"); jQuery(this).unbind("click"); //window.open("./helloworld.html"); window.showModalDialog("./helloworld.html", window, "dialogWidth=500px;dialogHeight=400px;status=no;help=no;scrollbars=no"); jQuery(this).attr('id'); }); })

本文で述べたことが皆さんのjQueryプログラム設計に役立つことを願っています.