Note: I am new to jQuery and tabs.
I am attempting to implement nested tabs with jQuery tabs in an MVC 5 web application. For some reason, the implementation is not working correctly and I assume there is a bug based on the behavior on the website and I suspect it is with how the active tab is being set.
When the user logs in, they are taken to a page for MainAppTabs
. The two top tabs are Client
and Account
. The Client
tab has nested tabs Client Info
, Billing Selections
, and About
whereas the Account
tab currently has only one nested tab called Account
, which should only display a list of accounts.
With the current implementation below, the Account tab is the first tab to be displayed, as opposed to the Client
tab, along with the nested Account
tab. When I click on the Client
tab then it will display fine with its nested tabs. However, when I click on the Account
tab again then the page clears out and I must refresh the page (F5) in order to get the Account
tab and its nested tabs to display. Also, the nested tab appears to be displayed twice where it is offset to the right and has a duplicate border, but the nested tab border and data spill outside of the parent tab border.
<div id="MainAppTabs">
<ul>
<li>@Html.ActionLink("Client", "ClientTabs", "ClientSetup")</li>
<li>@Html.ActionLink("Account", "AccountTabs", "AccountSetup")</li>
</ul>
</div>
<script>
$(function () {
$("#MainAppTabs").tabs({ active: 1 });
});
</script>
ClientTabs:
<div id="ClientSetupTabs">
<ul>
<li>@Html.ActionLink("Client Info", "Edit", "ClientSetup")</li>
<li>@Html.ActionLink("Billing Selections", "BillingSelections", "ClientSetup")</li>
</ul>
</div>
<script>
$(function ()
{
$("#ClientSetupTabs").tabs({ active: 1 });
});
</script>
AccountTabs:
<div id="AccountSetupTabs">
<ul>
<li class="active">@Html.ActionLink("Accounts", "Index", "AccountSetup")</li>
</ul>
</div>
<script>
$(function ()
{
$("#AccountSetupTabs").tabs({ active: 1 });
});
</script>