I\'m simply trying to apply HTML5 draggable=\'false\' attribute to some images but it\'s not working in Firefox browser. In Chrome working fine but on Firefox, after sele
Update of James Morrison's update: even the newer version doesn't seem to work anymore.
I could sort out a similar issue with a check inside the addEventListener("dragstart",...)
which you probably need to set in case you are playing with drag & drop. In my case:
document.addEventListener("dragstart", function( event ) {
if (event.target.parentNode.localName == 'li') {
// console.log("In case it's inside a - element, prevent the drag");
event.preventDefault();
} else {
// code taken from a Mozilla example, replace with what you need:
// store a ref. on the dragged elem
dragged = event.target;
// make it half transparent
event.target.style.opacity = .5;
}
}, false);
To check for an
the check would look something like if (event.target.localName == 'img') {...
As per the OP request: all of the "html only" solutions I have tried were not working.