jQuery UI switchClass()
method doesn\'t switch class, rather it performs some undesired animations and the class remains the same as the original one when I use
I am guessing you want to toggle between two classes. If that is the case you can do it with toggleClass function.
//first you start with one of the classes in html:
<div class="foo"></div>
//then in js you do:
var element = ...;
$(element).toggleClass('foo bar');
This will toggle both 'foo' and 'bar'. Since foo is already present it will remove it and add bar. On the next call bar will be present so i will remove it and add foo. And so on.
If something is not clear here is a jsfiddle example: https://jsfiddle.net/09qs86kr/1/