window.onload = () => { if(localStorage.getItem('type_sondage') == null) { localStorage.setItem('type_sondage', 'classique'); } console.debug(localStorage) let typeSondageElement = document.querySelectorAll("*[data-group='record']") typeSondageElement.forEach((currentElement) => { currentElement.addEventListener('change', function() { const selectedType = this.options[this.selectedIndex].text; localStorage.setItem('type_sondage', type_sondage); if(selectedType == "classique") { document.querySelector('#next').href = "reponses.html"; } else { document.querySelector('#next').href = "dates.html"; } }) }); }