While using e.preventDefault(); as in below code:
function preventEvent(e) {
e.preventDefault();
}
|
With IE browsers, I got an error message as: Object doesn't
support property or method 'preventDefault'
After spent some time I found out a way to handle
this, I have created one function as:
//Function to prevent Default
Events
function prevDefault(e) {
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
}
|
for IE browsers it will set e.returnValue as false
and our required functionality work like charm, now just call this function
wherever you want to use e.preventDefault(); as:
function preventEvent(e) {
prevDefault(e);
}
|
Hope it helps!!!
Sorry, but your code does not seem to be working. How exactly do you call that function where you expect to use e.preventDefault()?
ReplyDeleteHey,
ReplyDeleteit should work, just call preventDefault(e); method wherever you want to use e.preventDefault(); and function will do the rest. or you are facing any other issue do let me know
Great solution!!! This made my day. Thank you VERY much.
ReplyDelete