How can I toggle between two classes in jQuery, while the element does not have either class.
Please note: I want to know if there is a way to do this with the toggleClass()
method and not by addClass()
, removeClass()
. For example:
$('#myDiv').click(function(){
$("#myDiv").toggleClass('red blue')
})