Disable a link in IE9 - prototype stop() not working

IE9 is still in Beta, but all the same, here is a question:

Using prototype.js 1.6.1, proper form for adding a click event to a link, and override the default link behavior, would be:

mylink.observe('click', function(e){
   doSomething();
   e.stop();
});

While this works perfectly in every other browser that I tried, IE9 is a unique case. The default event behavior fires and my link takes me to the linked location. It seems that stop() isn't doing its job in IE9.

The following code works perfectly in IE9:

mylink.onclick = function(){
   doSomething();
   return false;
}

Any idea what I could do to fix the prototype methodology for use in IE9?

9
задан Brian Tompsett - 汤莱恩 20 July 2019 в 21:56
поделиться