Remove links’ outline in IE 7 and IE 6 with JQuery


IE 7 doesn’t respect css property outline so you can’t remove annoying outline using following css:

1
* :focus { outline: none; }

But you can remove it using JQuery ! Most of sites already have Jquery include so you don’t need to add anything except following code.

1
2
3
$("a").each(function() {
$(this).attr("hideFocus", "true").css("outline", "none");
});

If you’re using Mootools or Prototype – you can rewrite this code for these frameworks easily.
And this won’t affect your css validation!

Tags: , , ,