title: How to create previous button using javascript?
body: <p>when i click the submit button the page is redirect to next tab.But when i click Previous button the page is not redirect to previous tab..</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-js lang-js prettyprint-override"><code>$("#myTabs form").on('submit', function (e) {
    e.preventDefault();
    var linkHref = $(this).parents('.tab-pane').attr('id');
    $('#myLinks li a').removeClass('active');
    $('#myLinks li')
      .find('a[href="#' + linkHref + '"]')
      .parent()
      .next()
      .find('a')
      .tab('show')
      .addClass('active')
      .attr('data-toggle', 'tab');
      
    $('a.nav-link').not('.active').css('pointer-events', 'none');
  });
  
  $('a.nav-link').not('.active').css('pointer-events', 'none');
  
  
   $(document).ready(function () {
              $("#PrevProduct").click(function (e) {
                  e.preventDefault();
                  var linkHref = "tabs-1-tab-1";
                  $('#myLinks li a').removeClass('active');
                  $('#myLinks li')
                    .find('a[href="#' + linkHref + '"]')
                    .parent()
                    .next()
                    .find('a')
                    .tab('show')
                    .addClass('active')
                    .attr('data-toggle', 'tab');
                  $('a.nav-link').not('.active').css('pointer-events', 'none');
              });
          });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.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;div class="page-content"&gt;
      &lt;div class="container-fluid"&gt;
          &lt;header class="section-header"&gt;
              &lt;div class="tbl"&gt;
                  &lt;div class="tbl-row"&gt;
                      &lt;div class="tbl-cell"&gt;
                          &lt;h2&gt;Company Registration Form&lt;/h2&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/header&gt;
  
              &lt;section class="tabs-section"&gt;
                  &lt;div class="tabs-section-nav tabs-section-nav-icons"&gt;
                      &lt;div class="tbl"&gt;
                          &lt;ul class="nav nav-tabs" role="tablist" id="myLinks"&gt;
                              &lt;li class="nav-item"&gt;
                                  &lt;a class="nav-link active" href="#home" role="tab" data-toggle="tab"&gt;
                                      &lt;span class="nav-link-in"&gt;
                                          &lt;i class="font-icon font-icon-cogwheel"&gt;&lt;/i&gt;
                                          Company Registration Form
                                      &lt;/span&gt;
                                  &lt;/a&gt;
                              &lt;/li&gt;
                              &lt;li class="nav-item"&gt;
                                  &lt;a class="nav-link" href="#menu1" role="tab" data-toggle="tab"&gt;
                                      &lt;span class="nav-link-in"&gt;
                                          &lt;span class="glyphicon glyphicon-music"&gt;&lt;/span&gt;
                                          Company Social Network
                                      &lt;/span&gt;
                                  &lt;/a&gt;
                              &lt;/li&gt;
                              &lt;li class="nav-item"&gt;
                                  &lt;a class="nav-link" href="#menu2" role="tab" data-toggle="tab"&gt;
                                      &lt;span class="nav-link-in"&gt;
                                          &lt;i class="fa fa-product-hunt"&gt;&lt;/i&gt;
                                          Company Reference
                                      &lt;/span&gt;
                                  &lt;/a&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;&lt;!--.tabs-section-nav--&gt;
                  &lt;div class="tab-content" id="myTabs"&gt;
                      &lt;div role="tabpanel" class="tab-pane fade in active show" id="home"&gt;
                          &lt;form id="form" action=""&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;!--.tab-pane--&gt;
                      &lt;div role="tabpanel" class="tab-pane fade" id="menu1"&gt;
                          &lt;form id="form" action=""&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;button type="button" id="PrevProduct" class="btn btn-rounded btn-inline btn-primary"&gt;Previous&lt;/button&gt;
                          &lt;/form&gt;
                      &lt;/div&gt;&lt;!--.tab-pane--&gt;
                      &lt;div role="tabpanel" class="tab-pane fade" id="menu2"&gt;
                          &lt;form id="form" action=""&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;!--.tab-pane--&gt;
                  &lt;/div&gt;&lt;!--.tab-content--&gt;
              &lt;/section&gt;
  
  
      &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>