title: Enable tabs one after the other on form submission
body: <p>There are 4 tabs and in that 4 tabs there are 4 forms, I want to write a jQuery program such that if I submit <code>Form1</code> in <code>tab1</code> then the <code>tab2</code> containing form should be enabled and when I submit <code>form2</code>, <code>tab3</code> containing form 3 should be enabled that goes on until I reach <code>form4</code>.</p>
  
  <p>I wrote the code but it is enabling all tabs instead of next one.</p>
  
  <p>I am a beginner in jQuery, please comment below for any query.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;title&gt;Bootstrap Case&lt;/title&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div class="container"&gt;
  
    &lt;ul class="nav nav-tabs" id="myLinks"&gt;
      &lt;li class="active"&gt;&lt;a data-toggle="tab" href="#home"&gt;Tab1&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a  href="#menu1"&gt;Tab2&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a  href="#menu2"&gt;Tab3&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a  href="#menu3"&gt;Tab4&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  
    &lt;div class="tab-content" id="myTabs"&gt;
      &lt;div id="home" class="tab-pane fade in active"&gt;
          &lt;h1&gt;Form 1&lt;/h1&gt;
          &lt;form&gt;
        &lt;div class="form-group"&gt;
          &lt;label for="email"&gt;Email:&lt;/label&gt;
          &lt;input type="email" class="form-control" id="email" placeholder="Enter email"&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;label for="pwd"&gt;Password:&lt;/label&gt;
          &lt;input type="password" class="form-control" id="pwd" placeholder="Enter password"&gt;
        &lt;/div&gt;
        &lt;div class="checkbox"&gt;
          &lt;label&gt;&lt;input type="checkbox"&gt; Remember me&lt;/label&gt;
        &lt;/div&gt;
        &lt;button type="submit" class="btn btn-default"&gt;Submit&lt;/button&gt;
    &lt;/form&gt;
      &lt;/div&gt;
      &lt;div id="menu1" class="tab-pane fade"&gt;
          &lt;h1&gt;Form 2&lt;/h1&gt;
          &lt;form&gt;
        &lt;div class="form-group"&gt;
          &lt;label for="email"&gt;Email:&lt;/label&gt;
          &lt;input type="email" class="form-control" id="email" placeholder="Enter email"&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;label for="pwd"&gt;Password:&lt;/label&gt;
          &lt;input type="password" class="form-control" id="pwd" placeholder="Enter password"&gt;
        &lt;/div&gt;
        &lt;div class="checkbox"&gt;
          &lt;label&gt;&lt;input type="checkbox"&gt; Remember me&lt;/label&gt;
        &lt;/div&gt;
        &lt;button type="submit" class="btn btn-default"&gt;Submit&lt;/button&gt;
    &lt;/form&gt;
      &lt;/div&gt;
      &lt;div id="menu2" class="tab-pane fade"&gt;
          &lt;h1&gt;Form 3&lt;/h1&gt;
          &lt;form&gt;
        &lt;div class="form-group"&gt;
          &lt;label for="email"&gt;Email:&lt;/label&gt;
          &lt;input type="email" class="form-control" id="email" placeholder="Enter email"&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;label for="pwd"&gt;Password:&lt;/label&gt;
          &lt;input type="password" class="form-control" id="pwd" placeholder="Enter password"&gt;
        &lt;/div&gt;
        &lt;div class="checkbox"&gt;
          &lt;label&gt;&lt;input type="checkbox"&gt; Remember me&lt;/label&gt;
        &lt;/div&gt;
        &lt;button type="submit" class="btn btn-default"&gt;Submit&lt;/button&gt;
    &lt;/form&gt;
      &lt;/div&gt;
      &lt;div id="menu3" class="tab-pane fade"&gt;
          &lt;h1&gt;Form 4&lt;/h1&gt;
          &lt;form&gt;
        &lt;div class="form-group"&gt;
          &lt;label for="email"&gt;Email:&lt;/label&gt;
          &lt;input type="email" class="form-control" id="email" placeholder="Enter email"&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;label for="pwd"&gt;Password:&lt;/label&gt;
          &lt;input type="password" class="form-control" id="pwd" placeholder="Enter password"&gt;
        &lt;/div&gt;
        &lt;div class="checkbox"&gt;
          &lt;label&gt;&lt;input type="checkbox"&gt; Remember me&lt;/label&gt;
        &lt;/div&gt;
        &lt;button type="submit" class="btn btn-default"&gt;Submit&lt;/button&gt;
    &lt;/form&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
    &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
   $("#myTabs form").on('submit',function() {
     $('#myLinks li a').each(function(){
      $(this).attr('data-toggle','tab');
     });
   });
    &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>