IE7 preventDefault() not working on skip links
- by josh
I currently have skip links that jump to the div ids and was using e.preventDefault() to stop the url from changing when jumping to the element but in IE7 and IE8 it doesn't work at all using e.preventDefault() and if I take it out the url changes to the div the anchor tag contains reference to. Is their any fix or way around this?
Here is the code
$('body').delegate('a.skiplink-accessible-text', 'click', function (e) {
//e.preventDefault();
if (!$.browser.msie) {
e.preventDefault();
}
var jumpTo = $(this).attr('href');
$('body').find(jumpTo).attr('tabindex', - 1).focus();
});
EDIT: heres a little jsbin example for testing purposes
http://jsbin.com/welcome/20846/edit