Reputation: 11665
I'm using a jQuery plugin which organizes my content into vertical tabs.
Some of my tabs are hidden at page load and should show depending on the value of a Drop-down. My issue is, when I'm trying to load the tabs on change of dropdown (basically I .show()
the tabs and its content and reinitialize the plugin), the content shows up all in one tab and doesn't work perfectly.
Please check the example created at JSbin to know what I am speaking about.
Upvotes: 1
Views: 289
Reputation: 2529
Make it simply
function checkPlan(plan) {
if (plan == 'Basic') {
jQuery('li.premService').hide();
jQuery('li.premPlusService').hide();
} else if (plan == 'Premium') {
jQuery('li.premService').show();
jQuery('li.premPlusService').hide();
} else if (plan == 'Premium Plus') {
jQuery('li.premService').show();
jQuery('li.premPlusService').show();
}
}
Error is : you have to show only the tab so here I have added li
on the selector li.premService
,li.premPlusService
.....
WithOut li
it will get all the elements which have the class premService
...
demo : http://jsbin.com/IzAgejo/4/edit
Upvotes: 2