0

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;
});
Community
  • 1
  • 1
Setaper
  • 171
  • 12
  • 1
    One of the comments on the selected answer might help you: "It's worth noting that "event" must be the global event object in IE8. You can't use the event passed into the event handler, like e.preventDefault, it must be event.preventDefault in order for this to work in IE8. –" – scrappedcola Aug 14 '12 at 15:56
  • yes, i use(steveax), i already try this, but i'll try it again( scrappedcola) – Setaper Aug 14 '12 at 16:05

1 Answers1

2

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...

e.preventDefault();

Cross browser issues are fixed.

Your trouble is probably that you're doing it on a mousedown event with an element that has no default behavior for mousedown.


To prevent whatever default behavior you're trying to prevent, you'll probably need to do it using the click event.

var vtk = $("#vtkPic");

vtk.bind('click', function(e) {
     e.preventDefault();

})
   .bind('mousedown', function(e) {
        vtk_mouseDown(e);
    });
  • after ,mousedown it still appear 'not-allowed' cursor(I use it on image) – Setaper Aug 14 '12 at 16:12
  • @Setaper: I have no idea what that means. –  Aug 14 '12 at 16:13
  • nothing( to see this bug, go [here](http://online.cae-fidesys.com/en/welcome) user: khakhulin@saldlab.com, pass: 1 Go to Cases, click on 'test', after that click on 'Voluem Mesh 1', and chose view mesh and try to rotate – Setaper Aug 14 '12 at 16:30