IE8: object does not support this property or method

I know that my problem is known, I just can’t figure out how to solve the problem. However, the code works in chrome, ff and safari, but not in ie6-8. I tried to debug the code, and after it the following appeared: Line: 272 Error: the object does not support this property or method.

This is line 272 from my js file

$('#page1')[0].addEventListener('webkitAnimationEnd', self.webkitAnimationEnd, true); 

Do you have an idea what is wrong with him? I use jquery <script type="text/javascript" src="js/jquery-1.4.3.min.js">;</script> , which is called in my .html file.

I appreciate any help or helpful hint. Thank you in advance.

+4
source share
2 answers

use attachEvent for IE here is the SO link. MSIE and addEventListener problem in Javascript?

your code may look like

 if ( $.browser.msie ) { $('#page1')[0].attachEvent('webkitAnimationEnd', self.webkitAnimationEnd); } 

hope this helps

+2
source

See mozilla docs for a description and troubleshooting.

 var el = $('#page1')[0]; if (el.addEventListener){ el.addEventListener('webkitAnimationEnd', self.webkitAnimationEnd, true); } else if (el.attachEvent){ el.attachEvent('webkitAnimationEnd', self.webkitAnimationEnd); } 
+5
source

All Articles