开发者

Remove OnDblClick Event on Item using jQuery

开发者 https://www.devze.com 2023-04-06 00:31 出处:网络
I have the following code attached to an item on a web page: (function(){ var vName = $(\"#NAME\").substr(2);

I have the following code attached to an item on a web page:

(function(){
  var vName = $("#NAME").substr(2);
  $("#NAME").ondblclick   = new Function("vName+".remove();");
  $("#NAME_2").ondblclick = new Function("processMove();");
})();

The code so much is not an issue but what I would like to do, via jQuery is to remove the ability to perform a "ondblclick" on this it开发者_C百科em, i.e., would like to remove this function or double clicks on this item altogether, only for a particular criteria, which again is not important as part of this question.


Just .unbind() it:

$('selector').unbind('dblclick');


Its been a while since this thread has been opened but thought I would post my solution.

jQuery(function(j$){//This will execute on page load

  $('selector').prop('ondblclick', "");
});

This sets the ondblcli

0

精彩评论

暂无评论...
验证码 换一张
取 消