Bootstrap get active tabs index using jQuery Example

Bootstrap get active tabs index using jQuery Example

Today, We want to share with you Bootstrap get active tabs index using jQuery Example.In this post we will show you bootstrap tabs get active tab id, hear for jQuery Get Selected Bootstrap Tab or Active Tab on Click (Change) Example we will give you demo and example for implement.In this post, we will learn about Find Active Tab using jQuery and Twitter Bootstrap with an example.

Bootstrap get active tabs index using jQuery Example

There are the Following The simple About Bootstrap get active tabs index using jQuery Example Full Information With Example and source code.

  vuejs filter 2 decimal places

As I will cover this Post with live Working example to develop bootstrap get active tab index, so the bootstrap set active tab javascript for this example is following below.

Example 1 : Twitter Bootstrap get active

Get Active Tab using jQuery with Twitter Bootstrap

// UL Li Twitter Bootstrap defines the active class
$("ul#currentTabs li.active")

//An alternative -> shown event of each tab
var currentTab = null;
$('a[data-toggle="tab"]').on('shown', function (e) {
  currentTab = e.target;
})

Example 2 : bootstrap get active tab index

index.html

<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title>Find Active Tab using jQuery and Twitter Bootstrap</title>
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
      <script type="text/javascript">
         $(function () {
             $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
                 var target = $(e.target).attr("href")
                 alert(target);
             });
         })
      </script>
   </head>
   <body>
      <h1>how to get active bootstrap tab id in jquery</h1>
      <form id="form1">
         <br />
         <ul class="nav nav-tabs" >
            <li><a href="#tab1" data-toggle="tab">Home</a></li>
            <li><a href="#tab2" data-toggle="tab">AboutUS</a></li>
            <li><a href="#tab3" data-toggle="tab">Contactus</a></li>
         </ul>
         <div>
            <div class="tab-content" id="tabs">
               <div class="tab-pane" id="tab1">...Sample Home...</div>
               <div class="tab-pane" id="tab2">...Sample AboutUS...</div>
               <div class="tab-pane" id="tab3">...Sample Contactus...</div>
            </div>
         </div>
      </form>
   </body>
</html>

Example 3 : Bootstrap tab activation in JQuery

javascript – Bootstrap tab activation with JQuery

<ul class="nav nav-tabs" style="text-align: left;">
    <li class="active"><a href="#home" data-toggle="tab" id="home_tab">Home</a></li>
    <li><a href="#about" data-toggle="tab" id="about_tab">about</a></li>
    <li><a href="#contact" data-toggle="tab" id="contact_tab">contact</a></li>
</ul>

<div class="tab-content">

    <div id="home" class="tab-pane fade in active">
        HOME Page Data Contents
        <a class="btn btn-primary btn-lg" onclick="$('#about_tab').trigger('click')">about</a>
        <a class="btn btn-primary btn-lg" onclick="$('#contact_tab').trigger('click')">contact</a>
    </div>

    <div id="about" class="tab-pane fade in">
        About Page Data Contents
    </div>

    <div id="contact" class="tab-pane fade in">
        Contact Page Data Contents
    </div>
</div>

Angular 6 CRUD Operations Application Tutorials

Read :

  Dynamically set active tab in jquery

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Bootstrap get active tabs index using jQuery Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Reply

avatar
  Subscribe  
Notify of