Reputation: 1423
All images are draggable="true"
by default.
How can I prevent all images (and also user selected segments) in a page to be dragable, except few images.
I'm looking for a dynamically code in JS
and not HTML
code (by addEvent()
function).
For example Here: http://html5demos.com/drag you can drag and drop the HTML5 logo inside the trash image, case that was not supposed to happen.
Upvotes: 2
Views: 87
Reputation: 75707
document.addEventListener('dragstart', function(e) { e.preventDefault(); });
The usual cross browser event attaching provisos apply.
Upvotes: 2