-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquestionsItems.js
More file actions
33 lines (28 loc) · 1.09 KB
/
questionsItems.js
File metadata and controls
33 lines (28 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// SCRIPT
var numboiteClick = -1;
var repondu = false;
var bonneRep = 3; // Numéro de la bonne réponse (A FIXER ULTERIEUREMENT)
$(function (){
$(".boite").click(function() {
if(!repondu) {
numboiteClick = this.getAttribute("id").substring(5);
for (i = 1; i <= 3; i++){
$(document.getElementById("boite" + i)).removeClass("disabled");
$(document.getElementById("boite" + i)).removeClass("boiteClicked");
}
$(document.getElementById("boite" + numboiteClick)).addClass("boiteClicked");
$(document.getElementById("boite" + numboiteClick)).addClass("disabled");
}
}
);
$("#validerRepItem").click(function () {
repondu = true;
if(numboiteClick != bonneRep){
$("#boite"+numboiteClick).removeClass("boiteClicked");
$("#boite"+numboiteClick).addClass("mauvaiseReponse");
}
$("#boite"+bonneRep).addClass("bonneReponse");
for (i = 1; i <= 3; i++)
$(document.getElementById("boite" + i)).addClass("disabled");
});
});