lundi 11 septembre 2017

need help! checkbox hide and show div

i have problem this work and all fine but the checkbox not so good if i mark checkbox1 after reload it's mark the checkbox2 and checkbox1 i must help to find how this work save only the checkbox mark

    $(function(){        
$('#checkbox1')
  .prop('checked', localStorage.input === 'true')
  .on('change', function() {
     localStorage.input = this.checked;
     if (this.checked) {
       $('.column_category').show(0); //checked
     } else {
       $('.column_category').hide(0);
     }
  })
  .trigger('change');
});
$(function(){        
$('#checkbox2')
  .prop('checked', localStorage.input === 'true')
  .on('change', function() {
     localStorage.input = this.checked;
     if (this.checked) {
       $('.column_sku').show(0); //checked
     } else {
       $('.column_sku').hide(0);
     }
  })
  .trigger('change');
 });


<input type="checkbox" id="checkbox1"/><label for="cbxShowHide">Categories</label>
<input type="checkbox" id="checkbox2"/><label for="cbxShowHide">SKU</label>
<input type="checkbox" id="checkbox3"/><label for="cbxShowHide">UPC</label>

Aucun commentaire:

Enregistrer un commentaire