![](/img/trans.png)
[英]I want to store a function in variable and want to call that at onclick event
[英]I want to disabled onClick event for image inside div onClick function?
我想使用图像id
禁用图像的点击事件,例如。 对于id12
我想禁用点击事件。 我尝试使用unbind但它似乎只有在使用j查询绑定事件时才有效?
$("#id12").on('click',function(e){
e.preventDefault();
});
$("#id12").on('click',function(){
return false;
});
$("#id12").click(function () { return false; });
$("#id12").on('click',function(e){ e.preventDefault(); });
$("#id12").on('click',function(e){
e.preventDefault();
});
以下是纯JavaScript代码。 尝试这个 :
document.getElementById('id12').setAttribute("onclick", null);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.