W3.JS Toggle Class
Toggle the Class of HTML elements
Toggle a class (on/off):
w3.toggleClass(selector,'class')
Toggle between two classes:
w3.toggleClass(selector,'property','class','class')
Toggle Class by Id
Toggle between the "marked" class of an element with id="London":
Toggle Class by Tag
Toggle between the "marked" class of all <h2> elements:
Toggle Class by Class
Toggle between the "marked" class of all elements with class="city":
Toggle Multiple Classes
Toggle between the class name "class1" and "class2" of id="London:
Example
<button onclick="w3.toggleClass('#London','class1','class2')">Toggle</button>