summaryrefslogtreecommitdiff
path: root/modules/zelfoverhoor/docent.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/zelfoverhoor/docent.js')
-rw-r--r--modules/zelfoverhoor/docent.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/modules/zelfoverhoor/docent.js b/modules/zelfoverhoor/docent.js
index 96ec38b..456ea2f 100644
--- a/modules/zelfoverhoor/docent.js
+++ b/modules/zelfoverhoor/docent.js
@@ -152,6 +152,14 @@ function closeQSetForm(){
currentlyEditing=null;
}
+function renumberQuestions(){
+ var parent=document.getElementById("newquestions");
+ var ch=parent.children,nc=ch.length;
+ for(var i=0;i<nc;i++){
+ ch[i].getElementsByClassName("questionindex")[0].innerHTML=i+1;
+ }
+}
+
function addNewQuestion(){
var parent=document.getElementById("newquestions");
@@ -161,7 +169,12 @@ function addNewQuestion(){
var span=document.createElement("span");
span.setAttribute("style","display:inline-block");
var b=document.createElement("b");
- b.appendChild(document.createTextNode("Vraag:"));
+ b.appendChild(document.createTextNode("Vraag "));
+ var span2=document.createElement("span2");
+ span2.classList.add("questionindex");
+ span2.innerHTML=parent.children.length+1;
+ b.appendChild(span2);
+ b.appendChild(document.createTextNode(":"));
span.appendChild(b);
span.appendChild(document.createElement("br"));
var qta=document.createElement("textarea");
@@ -183,8 +196,10 @@ function addNewQuestion(){
input.setAttribute("value","verwijder vraag");
input.setAttribute("style","vertical-align:50px");
input.addEventListener("click",function(){
- if(confirm("Weet je zeker dat je de volgende vraag wil verwijderen?\n"+qta.value)){
+ var index=div.getElementsByClassName("questionindex")[0].innerHTML;
+ if(confirm("Weet je zeker dat je vraag "+index+" wilt verwijderen?")){
parent.removeChild(div);
+ renumberQuestions();
}
});
span.appendChild(input);