Replacing class repeatedly in JQuery using the addClass and removeClass functions is inefficient for some operations. There is no official replaceClass function but there is a toggleClass function. To change (toggle) between two classes easily use the code $("element").toggleClass(classname1 classname2) for an element already assigned to class= "classname1".
No comments:
Post a Comment