I use something like:

(event.preventDefault) ? event.preventDefault() : event.returnValue = false; 

the event.returnValue property is the closest IE equivalent to preventDefault.

Using

return false;

can sometimes also work, but it can lead to unexpected behavior sometimes when mixed with e.g. jQuery (jQuery also does stopPropagation...which is usually what you want, but...), so I prefer not to rely on it.


IE8 does not support preventDefault; it has returnValue instead. jQuery should normalize that for you, though. Are you sure you are calling preventDefault on the jQuery event wrapper (and not the actual event object)?


in IE, you can use

event.returnValue = false;

to achieve the same result.

And in order not to get an error, you can test for the existence of preventDefault:

if(event.preventDefault) event.preventDefault();



source - 

http://stackoverflow.com/questions/4422045/preventdefault-alternative-for-ie8

http://stackoverflow.com/questions/1000597/event-preventdefault-function-not-working-in-ie





Posted by linuxism
,