Friday, October 06, 2006

Fixing quotes with jQuery

It is easy to solve the problem with quotes in Internet Explorer (the problem being that they are not contained in quotation marks) by using jQuery.

All it takes is one line of code:

$("q").prepend("“").append("”");

However, that means there are two quotes for browsers that do support the tag. A browser sniff is all that is needed (generally it is a bad idea to do that, but some circumstances require it).

if($.browser.msie)
{
 $("q").prepend("“").append("”");
}

Demo page

No comments: