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 

Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts