Showing posts with label jQuery IE CSS browser condition detection. Show all posts
Showing posts with label jQuery IE CSS browser condition detection. Show all posts

Friday, February 19, 2010

Using jQuery to overcome IE deficiencies

OK. Here is my attempt to add some code to the blog.
I recently faced a problem that IE doesn't really support the visibility style properly. Now you can't really have conditions in your CSS code. I have always found a problem with using those awful !IE comments in the HTML head.

What you can do is add CSS elements to your page using jQuery. You can therefore put conditions in your jQuery and apply one type of style to IE and another to browsers which are prepared to work within W3C standards.

if($.browser.msie)
{
$("#myID").css("display","none");
}
else
{
$("#myID").css("visibility","collapse");
}