Advertisement
beyondCreation

Javascript Generating Input Fields

Apr 12th, 2015
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset="UTF-8">
  5.     </head>
  6.     <body>
  7.         <h1>Admin Panel</h1>
  8.         <div class="container">
  9.             <!-- JavaScript Validation -->
  10.             <b>How many questions</b> <input type="text" id="numOfQue" value="" />
  11.             <button onclick="generateQuestions()">Continue</button>
  12.             <script>
  13.                 function generateQuestions() {
  14.                     var numberOfQuestions = document.getElementById("numOfQue").value;
  15.  
  16.                     for (var i = 1; i <= numberOfQuestions; i++) {
  17.                         details.innerHTML += (i) + "<b> question: </b><input type='text' name='theQuestion'/><br><button id='next'>Some</button>";
  18.                         var button = document.getElementById("next").onclick = function () {
  19.                             var isClicked = true;
  20.                         }
  21.                     }
  22.                 }
  23.             </script>
  24.             <div id="details"></div>
  25.         </div>
  26.     </body>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement