When i click #tool I want to add the class .spanner to the div #drill.
#tool
.spanner
#drill
However when #drill has the class .spanner and #tool is clicked i want the class to be removed?
Use the toggleClass function:
toggleClass
$("#tool").click(function() { $("#drill").toggleClass("spanner"); });
1.4m articles
1.4m replys
5 comments
57.0k users