Possible Duplicate:
JavaScript: remove event listener
I am attempting to remove some event listeners from a navigation, after a start button is clicked. I can't seem to get anything to fire.
Here is the code I'm using to do it:
var startButton = document.getElementById('startButton');
startButton.addEventListener('click', function() {
hrNav.removeEventListener('mousedown', highlight, false);
alert('Did it remove the listener?');
}, false);
The eventlistener
that I'm trying to remove is:
if(hrNav.addEventListener){
hrNav.addEventListener('mousedown', highlight, false);
return true;
} else {
hrNav.attachEvent('on'+'click', highlight);
return true;
}
All of it is wrapped in a jQuery document.ready
function.