i have a simple example of using removeClass but it doesnt seem to work properly. Im not sure why i cant see the problem
html
<ul id="alljobs" class="hide">123</ul>
<ul id="jobs" class="hide">123</ul>
css
.hide{color:red;}
js
var x=1;
if (x ==1 ){
$('#jobs').removeClass('.hide');
}
in this case one ul text color should be black, but it isn’t
any ideas?
here is my jsfiddle
thanks
You need to take out the period in your class name. The period is used in a selector for noting that the string to follow is a class name. But in the
removeClass()function, the parameter is simply a string that is the class’ name.The fixed jQuery code, in total, would be this: