I'm a little tired of my brain and I would like to know if anyone knows how I can find the active tab using jQuery and Twitter Bootstrap. Pulling a hash from a URL is not my first option, I use the data-toggle attribute in the <a> link, so there is no need to create a hash URL.
Any insight? Here is an example of my markup:
<ul class="nav nav-list" id="sampleTabs"> <li><a href="#example" data-toggle="tab">Tab 1</a></li> </ul> <div class="tab-content"> <div class="tab-pane fade active in" id="example"> Example Tab </div> </div> <script> $('#sampleTabs a:first').tab('show'); </script>
I am open to any suggestion - using a PHP session, JS cookie, etc.
Edit: This is a real problem. I have a pagination system using PHP, so when the page number or next / previous arrow is clicked, it will reload the page. This is why I need to find the active tab before loading the next page, since I just send it to the url or session, etc.
jquery twitter-bootstrap tabs
wiliam.orazi Aug 20 2018-12-18T00: 00Z
source share