This is my modal that includes some checkboxes with an option to select all, please let me know how to keep the boxes checked after I refresh the page only using jquery not localstorage:
<!--Modal-->
<div class="modal fade" id="invoiceOptions" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body text-justify">
<form class="form">
<div class="form-group">
<div class="input-group checkbox">
<label>
<input type="checkbox" name="select-all" id="checkAll"/>
Select All
</label>
<br>
<label>
<input type="checkbox" class="invoiceOption"/>
Item 1
</label>
<label>
<input type="checkbox" class="invoiceOption"/>
Item 2
</label>
<label>
<input type="checkbox" class="invoiceOption"/>
Item 3
</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="saveBtn" value="" data-dismiss="modal">
save
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!--/Modal-->
This is the jquery script for my modal:
<script>
$('#checkAll').click(function(event) {
if(this.checked) {
$('.invoiceOption').each(function() {
this.checked = true;
});
} else {
$('.invoiceOption').each(function() {
this.checked = false;
});
}
});
</script>
Aucun commentaire:
Enregistrer un commentaire