forked from tykayn/funky-framadate-front
Création du fichier js
This commit is contained in:
parent
1cc8e6beb4
commit
cb07e90e63
@ -40,24 +40,7 @@
|
|||||||
<a href="reponses.html" class="btn" id="next">Continuer</a>
|
<a href="reponses.html" class="btn" id="next">Continuer</a>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<script>
|
<script src="script.js"></script>
|
||||||
window.onload = () => {
|
|
||||||
var monStockage = localStorage;
|
|
||||||
localStorage.setItem('type_sondage', 'classique');
|
|
||||||
|
|
||||||
document.querySelector('#type_sondage').addEventListener('change', function() {
|
|
||||||
const selectedType = this.options[this.selectedIndex].text;
|
|
||||||
localStorage.setItem('type_sondage', type_sondage);
|
|
||||||
console.log(selectedType);
|
|
||||||
if(selectedType == "classique") {
|
|
||||||
document.querySelector('#next').href = "reponses.html";
|
|
||||||
} else {
|
|
||||||
document.querySelector('#next').href = "dates.html";
|
|
||||||
}
|
|
||||||
console.log(document.querySelector('#next'))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
19
public/script.js
Normal file
19
public/script.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
window.onload = () => {
|
||||||
|
var monStockage = localStorage;
|
||||||
|
if(localStorage.getItem('type_sondage') == undefined) {
|
||||||
|
localStorage.setItem('type_sondage', 'classique');
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelector('#type_sondage').addEventListener('change', function() {
|
||||||
|
const selectedType = this.options[this.selectedIndex].text;
|
||||||
|
localStorage.setItem('type_sondage', type_sondage);
|
||||||
|
console.log(selectedType);
|
||||||
|
if(selectedType == "classique") {
|
||||||
|
document.querySelector('#next').href = "reponses.html";
|
||||||
|
} else {
|
||||||
|
document.querySelector('#next').href = "dates.html";
|
||||||
|
}
|
||||||
|
console.log(document.querySelector('#next'))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user