Skip to main content

Posts

Showing posts from March, 2012

Workaround with e.preventDefault(); not working in IE

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