Javascript examples for DOM:Mouse Event
Handle drag start event on <img>
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//w w w . j a v a2s . c om document.querySelectorAll('img').forEach(el=> { el.addEventListener('dragstart', e => { e.preventDefault(); return false; }); }); } </script> </head> <body> <img src="http://www.java2s.com/style/download.png" draggable="false"> </body> </html>