I used wp_enqueue_script to load it in the header:
The code in my functions.php is
function cool_scripts() {
wp_enqueue_script( 'cool-stuff', get_stylesheet_directory_uri() . '/custom_js/scripts.js', array('jquery'), 'false', false);
}
add_action( 'wp_enqueue_scripts', 'cool_scripts' )
My current scropts.js looks like this:
function save(){
var checkbox = document.getElementById('checkbox1zaal1');
localStorage.setItem('checkbox1zaal1', checkbox.checked);
}
function load(){
var checked = JSON.parse(localStorage.getItem('checkbox1zaal1'));
document.getElementById("checkbox1zaal1").checked = checked;
}
function wis(){
location.reload();
localStorage.clear()
}
load();
I think I have to change the code in order to make it work. Do you have any idea why this doesn’t work?
Best regards
Mathias