You can use the functions addClass
and removeClass
to add or remove a class to your element.
For example
$('#myId').addClass('myClass');
or
$('#myId').addClass('myClass');
where
.myClass { display: none; }
is, would add or remove the class myClass
to an element with the id myId
. Try this fiddle.
Update: The fiddle is updated to remove a div with a link.
2
solved Hide class by default, show that class when clicking a link