I'm practicing using Event Handlers. I'm using addEventListener() to get it done, which is working just fine in Firefox. However I can't get it to work properly in IE9. From what I understand, addEventListener() Should work in major browsers including IE9 (attachEvent() in IE 8 and below). I know I'm using IE9, and I know Javascript is turned on as well. Yet the code that works in Forefox won't work in IE9. It's a simple alert box when a <p> element is clicked.
Code:
var para = document.getElementById("myp");
function clickHandler1() {
alert("You clicked me");
}
function clickHandler2() {
alert("You clicked me again");
}
Just real simple code for practice. Is what I'm reading about it working in IE9 incorrect and if so, what does work in IE9 because I've also tried attachEvent() and that didn't work either. Any help is appreciated.
Works fine in all browsers. Are you using IE9 with compatibility view turned on? The little torn page icon next to the refresh button is what I'm talking about. If it's lit up blue, it's switched on.