removeClass and addClass don't work
-
11-11-2019 - |
Question
i have a statement that checks if a tab is selected:
$( '#social_edit_pannels' ).tabs({
select: function(event, ui) {
var theSelectedTab = ui.index;
if (theSelectedTab == 0) {
$('ul li.ep-messages').removeClass('ep-messages').addClass('ep-messages-click');
$('ul li.ep-friends').removeClass('ep-friends-click').addClass('ep-friends');
}
else if (theSelectedTab == 1 ) {
$('ul li.ep-friends').removeClass('ep-friends').addClass('ep-friends-click');
$('ul li.ep-messages').removeClass('ep-messages-click').addClass('ep-messages');
}
}
});
What is happening is that only the first statement of remove'ing and adding classes works from each if statement.
for example when i run the script, it behaves like it would have only this:
if (theSelectedTab == 0) {
$('ul li.ep-messages').removeClass('ep-messages').addClass('ep-messages-click');
}
else if (theSelectedTab == 1 ) {
$('ul li.ep-friends').removeClass('ep-friends').addClass('ep-friends-click');
}
the second statement from each if... doesn't work. maybe it doesn't know if the classes are there??
any ideas?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow