Ideally you output this class from the server side, but if you can’t… Let’s say you have navigation like this: <nav> <ul> <li><a href=”/”>Home</a></li> <li><a href=”/about/”>About</a></li> <li><a href=”/clients/”>Clients</a></li> <li><a href=”/contact/”>Contact Us</a></li> </ul> </nav> And you are at the URL: http://yoursite.com/about/team/ And you want the About link to get a class of “active” so you can […]
Articles Tagged: Add Class
Add & Remove CSS Classes
// add css class $(“#DivID”).addClass(“newclassname”); // remove css class $(“#DivID”).removeClass(“classname”); // add & remove class together $(“#DivID”).removeClass(“classname”).addClass(“newclassname”); // add & remove multiple classes $(“#DivID”).removeClass(“classname classname2”).addClass(“newclassname newclassname2”);