I am trying to save the active state of Bootstrap nav tabs and send them as hidden field in the form so that i can maintain the active state on next load of the page.
My nav-tabs are ;
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" index="1" class="active"><a href="#text-only" aria-controls="text-only" role="tab" data-toggle="tab">Text only</a></li>
<li role="presentation" index="2"><a href="#with-pic" aria-controls="with-pic" role="tab" data-toggle="tab">With Pic</a></li>
<li role="presentation" index="3"><a href="#gallery" aria-controls="gallery" role="tab" data-toggle="tab">Gallery</a></li>
<li role="presentation" index="4"><a href="#map-view" aria-controls="map-view" role="tab" data-toggle="tab" >Map View</a></li>
</ul>
My nav-tab for contents are;
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="text-only">
</div>
<div role="tabpanel" class="tab-pane" id="with-pic">
</div>
<div role="tabpanel" class="tab-pane" id="gallery">
</div>
<div role="tabpanel" class="tab-pane" id="map">
</div>
</div>
I want to send the active state via form input field like
<form action="" method="get" name="search_form">
<input type="hidden" name="active_nav_tab" value="">
<input type="hidden" name="active_nav_content" value="">
<input type="submit" value="submit">
</form>
One Logic is to get active tab by Jquery but what will be the value which I will pass in the form fields. I am stuck. Will really appreciate any kind of help