Hello am confused and i need help with bootstrap tap retaining its current tab when a postback occurs at the server instead of going back to the first tab. I know this question has being asked before, but i just can't seem to implement the solution. Please be gentle and forgive a poor sinner. I have four tabs given below
<ul class="nav nav-tabs" data-tabs="tabs" id="myTab">
<li class="active"><a href="#cSession" title="Personal Information">Create Session</a> </li>
<li><a href="#cTerm" title="Admission Details">Create Term</a></li>
<li><a href="#cClass" title="Residential Address">Create Class</a></li>
<li><a href="#vClass" title="Residential Address">View Created Classes</a></li>
</ul>
My script to initiate the tab is
$(document).ready(function () {
var tab = $("#hidTAB").val;
$('#myTab a[href="' + tab + '"]').tab('show');
$('#myTab a[href="#cSession"]').click(function (e) {
e.preventDefault();
$("#myTab").removeClass("active");
$(this).addClass('active');
$(this).tab('show');
$("#hidTAB").val() = "cSession";
})
$('#myTab a[href="#cTerm"]').click(function (e) {
e.preventDefault();
$("#myTab").removeClass("active");
$(this).addClass('active');
$(this).tab('show');
$("#hidTAB").val() = "cTerm";
})
$('#myTab a[href="#cClass"]').click(function (e) {
e.preventDefault();
$("#myTab").removeClass("active");
$(this).addClass('active');
$(this).tab('show');
$("#hidTAB").val() = "cClass";
})
$('#myTab a[href="#vClass"]').click(function (e) {
e.preventDefault();
$("#myTab").removeClass("active");
$(this).addClass('active');
$(this).tab('show');
$("#hidTAB").val() = "vClass";
})
});
I read on this forum that the tab can be stored using a hidden field. I have tried implementing the idea from this post Remain bootstrap tab after postback c#. But i can,t seem to make it work. My jquery skills is as terrible as my french and i don't understand more than 10 phrases in French. Please i need help. Thanks