7
Internet Explorer Object doesn’t support property or method ‘preventDefault’
I was working on a web page where I need to show or hide a div on button click using jquery, very simple code like below:
$(function () { $('#btntest').click(function () { event.preventDefault(); $('#testdiv').toggle(); }); });
it was working fine in chorme browser, but in IE I get the error like Object doesn’t support property or method ‘preventDefault’
at first I started thinking is it a problem of IE, but as Jquery is well established library I had to think that there is something wrong in my code, then I started checking and I found without passing the event object parameter in the function and I was calling event.preventDefault();
so the fixing was also very simple I just have to pass the event object as parameter…
$(function () { $('#btntest').click(function (event) { event.preventDefault(); $('#testdiv').toggle(); }); });
бнанс March 26, 2024 - 9:54 am
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Pumarehistro April 1, 2024 - 12:54 am
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
registro de Binance April 1, 2024 - 8:08 pm
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Bonus Pendaftaran di Binance April 3, 2024 - 5:23 am
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Binance注册 April 4, 2024 - 2:45 am
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
100 USDT алу шн тркелу April 4, 2024 - 7:58 pm
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
izveidot binance kontu April 5, 2024 - 9:41 am
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.