How To Stop Images From Being Dragged Using JQuery Or Javacsript

Posted by Weston Ganger on July 14, 2016

// Using jQuery
$('img').on('dragstart', function(event) { event.preventDefault(); });

// Using plain javascript, must do each image individually
document.getElementById('my-image').ondragstart = function() { return false; };

Related External Links:

Posted in Javascript and Tagged with html javascript jquery 

Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts