[jQuery] IE - .addClass - I'll give you an example
OK, it looks like you have found a problem in IE. It has nothing to do with
jQuery, so knowing that will help lead you toward a solution. Try this code
with no JavaScript at all:
<html>
<head>
<style type="text/css">
#test{
width:100px;
height:100px;
display:block;
border:1px solid black;
}
#test.oneClass{
background-color:red;
}
#test.twoClass{
background-color:green;
}
</style>
</head>
<body>
<div id="test" class="twoClass">test</div>
</body>
</html>
I changed the classnames a bit, just to make sure the common prefix wasn't
somehow tripping up IE (I didn't expect that to be the problem, but it never
hurts to rule things out).
If you try this test in IE you'll get a white rectangle instead of green as
expected.
Can you throw in a wrapper div? That would make it easy to fix:
<html>
<head>
<style type="text/css">
#test{
width:100px;
height:100px;
display:block;
border:1px solid black;
}
#wrap .oneClass{
background-color:red;
}
#wrap .twoClass{
background-color:green;
}
</style>
</head>
<body>
<div id="wrap">
<div id="test" class="twoClass">test</div>
</div>
</body>
</html>
That will display as expected, and I'm sure if you throw back in the jQuery
code it will work too.
-Mike