Guest User

Untitled

a guest
Feb 15th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. function fieldAdd(){
  2. let qNumber = document.getElementById("qNum").value;
  3. let containerBlocQ=document.getElementById('containerBlocQ');
  4. totalNumOfQuest = qNumber - nbQst;
  5. if(qNumber<=0){
  6. totalNumOfQuest=0;
  7. }
  8. if(totalNumOfQuest>=0){
  9. for(let i=1; i <= totalNumOfQuest ; i++){
  10. addNewQues();
  11. }
  12.  
  13. }
  14. else{
  15. for(i=0;Math.abs(totalNumOfQuest);i++){
  16. //Here is the error
  17. removeLastQuestion();
  18. nbQst--;
  19. }
  20. }
  21.  
  22.  
  23. }
  24. function removeLastQuestion(){
  25. nbQst--;
  26. let containerBlocQ = document.getElementById('containerBlocQ');
  27. containerBlocQ.removeChild(containerBlocQ.lastChild);
  28. }
Add Comment
Please, Sign In to add comment