I have the following syntax in which I want to remove all css classes from the link tags. How can I do this using jquery?
<div id="nav">
<ul>
<li><a href="" class="foo">aa</a></li>
<li><a href="" class="bar">aa</a></li>
<li><a href="" class="yay">aa</a></li>
</ul>
</div>
You can use the
removeClass()method; if you call it without an argument it removes all classes:Obviously you can chain
.addClass('someClass')in the same call; you asked to change the class in your question’s subject after all. 😉