Does Not Work
CSS
.active
{
display: block;
}
JS
$("#li_1 ul").addClass('active');
Does Work
JS
$("#li_1 ul").css('display', 'block');
Which leads to me my question, why does the css function work and not the addClass? There’s no difference between the selectors at all.
Additional info –
- Using jQuery version 1.6.4
- JS in question here resides in a .js file being included in an
ASP.NET masterpage - masterpage has link to stylesheet containing the CSS in question
here (ie – the ‘active’ style is available to the masterpage)
What about using this statement:
I think something overrides your
.activerule in your CSS stylesheet.More informations about CSS priorities right here.