Private
Public Access
1
0
Files
rowsandall/rowers/templates/menuscript.html
2018-10-23 14:51:53 +02:00

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>