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.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/modules/zelfoverhoor/docent.js b/modules/zelfoverhoor/docent.js
index c14fb2e..b44d4b6 100644
--- a/modules/zelfoverhoor/docent.js
+++ b/modules/zelfoverhoor/docent.js
@@ -181,17 +181,33 @@ function renumberQuestions(){
function addNewQuestion(){
var parent=document.getElementById("newquestions");
+ var number=parent.children.length;
var div=document.createElement("div");
div.classList.add("newquestioncontainer");
+ if(number>0){
+ var insertbtn=document.createElement("input");
+ insertbtn.setAttribute("type","button");
+ insertbtn.setAttribute("value","Voeg vraag hier toe");
+ insertbtn.setAttribute("style","margin-bottom:5px");
+ insertbtn.addEventListener("click",function(){
+ addNewQuestion();
+ var newdiv=parent.children[parent.children.length-1];
+ parent.insertBefore(newdiv,div);
+ renumberQuestions();
+ });
+ div.appendChild(insertbtn);
+ div.appendChild(document.createElement("br"));
+ }
+
var span=document.createElement("span");
span.setAttribute("style","display:inline-block");
var b=document.createElement("b");
b.appendChild(document.createTextNode("Vraag "));
- var span2=document.createElement("span2");
+ var span2=document.createElement("span");
span2.classList.add("questionindex");
- span2.innerHTML=parent.children.length+1;
+ span2.innerHTML=number+1;
b.appendChild(span2);
b.appendChild(document.createTextNode(":"));
span.appendChild(b);