I already read this, but i still can’t make it work. ‘e’ just don’t have property ‘returnValue’. What’s wrong?
Html
<img id="vtkPicImg" style="display: none;" jQuery17102915111663214694="47"/>
Here js code:
var vtk = $("#vtkPicImg");
vtk.bind('mousedown', function(e) {
e.preventDefault ? e.preventDefault() : e.returnValue = false;
vtk_mouseDown(e);
return false;
});
Update
Regarding your updated question, there is no “default” behavior when clicking an
<img>element, so naturally there’s nothing to prevent.Since you’re using jQuery, all you need is…
Cross browser issues are fixed.
Your trouble is probably that you’re doing it on a
mousedownevent with an element that has no default behavior formousedown.To prevent whatever default behavior you’re trying to prevent, you’ll probably need to do it using the
clickevent.