I have the following element handling inside a tap event binding.
$el
.doThis
.end()
.find( "a" ).first().removeClass( someClass );
I need to include a check for condition o.direction == "horizontal" and if the condition is true, I need to toggle instead of remove
However I can't get it to work. Trying like this:
$el
.doThis
.end()
.find( "a" ).first().toggleClass( someClass , ( o.direction == "horizontal" ? !isCollapse : event ) );
Toggles the class correctly if o.direction == "horizontal", but if it's not, I cannot remove instead of toggle.
Question:
Is there a way to check for a condition and perform a toggle if condition is met and a removeClass if not in a chained jquery statement?