I want to disable double click for some elements and the best way would be to use a special class for that.
I found this simple and short jQuery solution that is exactly what I want, but I need pure JavaScript code.
Possible? Please advice.
Been so long since I did straight jQuery free javascript but what you would want is something along these lines
var elements = document.getElementsByClassName("MyClassName");
for (var element in elements){
element.ondblclick = function(e){
return false;
}
}
for (var element in document.getElementsByClassName('disable-click')) {
element.onclick = function(e){
e.preventDefault();
}
}
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.