Base de reflexion pour l'ajout d'option

This commit is contained in:
Yannick Francois 2018-10-23 07:56:42 +02:00
parent 44b60adba0
commit 91b94e806f
4 changed files with 44 additions and 6 deletions

View File

@ -35,7 +35,7 @@
</section> </section>
<nav> <nav>
<a href="reponses.html" class="btn" id="next">Continuer</a> <a href="responses.html" class="btn" id="next">Continuer</a>
</nav> </nav>
</body> </body>

29
public/response-text.html Normal file
View File

@ -0,0 +1,29 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="referrer" content="same-origin">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Framadate</title>
<meta name="description" content=" ">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link crossorigin="anonymous" rel="stylesheet" href="https://rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap-reboot.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<label>
Texte
<input type="texte" value="">
<button class="clean">Nettoyage</button>
</label>
</body>
</html>

View File

@ -27,15 +27,14 @@
<option>des liens</option> <option>des liens</option>
</select> </select>
</p> </p>
<ul> <ul id="responses">
<li>
Image
</li>
</ul> </ul>
</section> </section>
<nav> <nav>
<a href="responses.html" id="add-response-choice" class="btn next">Ajouter</a>
<a href="responses.html" class="btn next">Tout effacer</a>
<a href="recapitulatif.html" class="btn next">Continuer</a> <a href="recapitulatif.html" class="btn next">Continuer</a>
</nav> </nav>

View File

@ -58,12 +58,22 @@ $$('input').forEach((inputElement) => {
}); });
}); });
$("#add-response-choice").addEventListener('click', (e) => {
e.preventDefault();
let response = document.createElement("li");
let text = document.createTextNode("Blabla");
response.appendChild(text);
$("#responses").appendChild(response);
});
if(document.getElementById("type_sondage")) { if(document.getElementById("type_sondage")) {
type_sondage.addEventListener('change', function() { type_sondage.addEventListener('change', function() {
let typeSondage = this.options[this.selectedIndex].text; let typeSondage = this.options[this.selectedIndex].text;
if(typeSondage == "classique") { if(typeSondage == "classique") {
localStorage.setItem('type_sondage', this.options[this.selectedIndex].text); localStorage.setItem('type_sondage', this.options[this.selectedIndex].text);
$('#next').href = "reponses.html"; $('#next').href = "responses.html";
} else { } else {
localStorage.setItem('type_sondage', 'dates'); localStorage.setItem('type_sondage', 'dates');
$('#next').href = "dates.html"; $('#next').href = "dates.html";