title: How to keep the button active after page refresh?
body: <p>I have two buttons that show and hide inputs when one of them selected. If the form is submitted when the oneway button is selected, the form reloads with an active return button. How do i get the active label(button) to still be active after the page reload/refresh?</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>$(document).ready(function() {
    $("label[name='oneway']").on("click", function() {
      $(".arrival").hide();
      $(".from").removeClass('col-lg-3');
      $(".from").addClass('col-lg-4');
      $(".to").removeClass('col-lg-3');
      $(".to").addClass('col-lg-4');
      $(".departure").removeClass('col-lg-3');
      $(".departure").addClass('col-lg-4');
      $("label[name='return']").removeClass('active');
      $(this).addClass('active');
      $('#trip').val('0');
    });
  
    $("label[name='return']").on("click", function() {
      $(".arrival").show();
      $(".from").removeClass('col-lg-4');
      $(".from").addClass('col-lg-3');
      $(".to").removeClass('col-lg-4');
      $(".to").addClass('col-lg-3');
      $(".departure").removeClass('col-lg-4');
      $(".departure").addClass('col-lg-3');
      $("label[name='oneway']").removeClass('active');
      $(this).addClass('active');
      $('#trip').val('1');
    });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form method="post" action=""&gt;
    &lt;div class="btn-group btn-group-toggle" data-toggle="buttons"&gt;
      &lt;label for="oneway" class="btn btn-default " name="oneway"&gt;One way&lt;/label&gt;
      &lt;label for="return" class="btn btn-default active" name="return"&gt;Return&lt;/label&gt;
    &lt;/div&gt;
  
    &lt;div class="form-row col-lg-12"&gt;
      &lt;div class="form-group col-lg-3 from"&gt;
        &lt;label for="From"&gt;From&lt;/label&gt;
        &lt;input type="text" class="form-control autocomplete" id="from" name="from" placeholder="Departure city" value=""&gt;
      &lt;/div&gt;
      &lt;div class="form-group col-lg-3 to"&gt;
        &lt;label for="To"&gt;To&lt;/label&gt;
        &lt;input type="text" name="to" class="form-control autocomplete" id="to" placeholder="Arrival city" value=""&gt;
      &lt;/div&gt;
      &lt;div class="form-group col-lg-3 departure"&gt;
        &lt;label for="DepartureDate"&gt;Departure Date&lt;/label&gt;
        &lt;div class="input-group date"&gt;
          &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-calendar"&gt;&lt;/i&gt;&lt;/span&gt;
          &lt;input id="date_added" type="text" name="dd" class="form-control" value=""&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group col-lg-3 arrival"&gt;
        &lt;label for="ArrivalDate"&gt;Arrival Date&lt;/label&gt;
        &lt;div class="input-group date"&gt;
          &lt;span class="input-group-addon"&gt;&lt;i class="fa fa-calendar"&gt;&lt;/i&gt;&lt;/span&gt;
          &lt;input id="date_modified" type="text" name="rd" class="form-control" value=""&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-row col-lg-12"&gt;
        &lt;button type="submit" name="confirm" class="btn btn-primary btn-lg " id="confirm"&gt;Confirm&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>