title: Jquery checkbox unchecks on submit
body: <p>My checkboxes are empty when page refreshes after submit. I would like to keep them checked. How can I do that in jquery?</p>
  
  <p>Here is my jquery code.</p>
  
  <pre><code>        $(document).ready(function () {
              $(':checkbox.selectall').on('click', function () {
                  $(':checkbox[id="' + $(this).data('checkbox-name') + '"]').prop("checked", $(this).prop("checked"));
                  $( "#frm1" ).submit();
              });
              $(':checkbox.checkme').on('click', function () {
                  var _selectall = $(this).prop("checked");
                  if (_selectall) {
                      $(':checkbox[name="' + $(this).attr('name') + '"]').each(function (i) {
                          _selectall = $(this).prop("checked");
                          return _selectall;
                      });
                  }
                  $(':checkbox[name="' + $(this).data('select-all') + '"]').prop("checked", _selectall);
                  $( "#frm1" ).submit();
              });
          });
  </code></pre>
  
  <p>My html is as follows...</p>
  
  <pre><code>&lt;input type='checkbox' id='selectall' name='sa_subcatinput[]' value='$row[id]'     
      data-checkbox-name='$row[id]' class='selectall'/&gt;&lt;/label&gt;&lt;/a&gt;&lt;/li&gt;
  
  &lt;input type='checkbox' name='subcatinput[]' value='$test[id]' id='$test[category]' 
      class='checkme'  data-select-all='sa_subcatinput[]'/&gt;
  </code></pre>