I want to disable click event for image using image id
eg. for id12
i want to disabled click event . i tried using unbind but it seems it only works if event is binded using j query?
$("#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();
});
Below is pure javascript code. Try this :
document.getElementById('id12').setAttribute("onclick", null);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.