36 lines
872 B
HTML
36 lines
872 B
HTML
<script
|
|
type='text/javascript'
|
|
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
|
</script>
|
|
<script>
|
|
$(document).ready(function(){
|
|
$(".has-children input").each(
|
|
function(i, obj) {
|
|
var theid = $(this).parent().attr('id');
|
|
var state = localStorage.getItem(theid);
|
|
if (state !== null) {
|
|
console.log('setting');
|
|
console.log(theid);
|
|
console.log(state);
|
|
if (state == 'true') {
|
|
$(this).prop('checked',true);
|
|
console.log('setting checked');
|
|
} else {
|
|
$(this).prop('checked',false);
|
|
console.log('removing checked');
|
|
};
|
|
};
|
|
console.log($(this).is(':checked'));
|
|
});
|
|
});
|
|
$(function() {
|
|
$(".has-children input").change( function() {
|
|
var theid = $(this).parent().attr('id');
|
|
var state = $(this).is(':checked');
|
|
console.log(theid);
|
|
console.log(state);
|
|
localStorage.setItem(theid,state);
|
|
});
|
|
});
|
|
</script>
|