title: How evaluate values for already checked boxes when page loads?
body: <p>I have page for cinema's seats model. User picks seats and has real-time price is showing up. The next step is to go to checkouts but if user changes his mind and want to change to different seats and clicks back on the browser, then returns to seats selection page. I managed to keep selected seats by using session id check. But can't keep prices saved.</p>
  
  <pre><code>$(document).ready(function () {
  var $inputs = $('.seats-c');
  var $output_seats = $('#span-seats');
  var $output_price = $('#span-price');
  var $output_taxes = $('#span-taxes');
  var $output_tot_price = $('#span-tot-price');
  var input_val;
  var seats_list_json;
  var seats_list;
  var seats;
  var price;
  var taxes;
  var last_entered;
  $inputs.on('click', function () {
      last_entered = this;
  });
  $inputs.on('change', function () {
      seats_list_json = $('#seatsList').val();
      seats_list = JSON.parse(seats_list_json);
      seats = 0;
      price = 0;
      taxes = 13; //%
      $inputs.each(function () {
          input_val = this.value;
          if (this.checked) {
              seats += 1;
              $.each(seats_list, function (key, value) {
                  if (input_val === key) {
                      price += value;
                  }
              });
          }
          if (seats &gt; 4) {
              $(last_entered).prop("checked", false);
              box(null, "Warning !", "Maximum amount is 4 seats per transaction", "alert-box");
          }
      });
      $output_seats.html(seats);
      $output_price.html(price);
      $output_taxes.html(taxes + "% taxes = $" + (price * (taxes / 100)).toFixed(2));
      $output_tot_price.html((price * ((taxes / 100) + 1)).toFixed(2));
  }); });
  </code></pre>