title: add textbox in jquery
body: <p>I am trying to create mcq question with dynamic id by using jquery. but i got stuck when i am defining a unique id for the option of each question. can somebody help me to find way to create unique id for each mcq option? below is my jquery</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript" src="jquery-1.10.2.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;script type="text/javascript"&gt;
  
  $(document).ready(function(){
  var counter = 2;//question
  
  $("#addQuestion").click(function () {
  
  var newTextBoxDiv = $(document.createElement('div'))
       .attr("id", 'TextBoxDiv' + counter);
  
  newTextBoxDiv.after().html('&lt;label&gt;Q'+ counter + ' : &lt;/label&gt;' +
        '&lt;input type="text" name="textbox' + counter + 
        '" id="textbox' + counter + '" value="" &gt;' + '&lt;/br&gt;' + 
        '&lt;label&gt;A. &lt;/label&gt;'+
        '&lt;input type="text" id="Q'+counter+'choice1"&gt;' +
        '&lt;input type="button" value="Add Option" id="'+ counter + '"&gt;');
  
  newTextBoxDiv.appendTo("#TextBoxesGroup");
  
  
  counter++;
   });
  
   $("#removeQuestion").click(function () {
  if(counter==1){
        alert("No question that can be deleted");
        return false;
     }   
  
  counter--;
  
      $("#TextBoxDiv" + counter).remove();
  
   });
  
   //$("#getButtonValue").click(function () {
  
  // var msg = '';
  //for(i=1; i&lt;counter; i++){
   // msg += "\n Textbox #" + i + " : " + $('#textbox' + i).val();
  //}
  //      alert(msg);
   //});
  });
  &lt;/script&gt;
  &lt;/head&gt;&lt;body&gt;
  </code></pre>
  
  <p>here is the html</p>
  
  <pre><code>&lt;div id='TextBoxesGroup'&gt;
  &lt;div id="TextBoxDiv1"&gt;
      &lt;label&gt;Q1 : &lt;/label&gt;&lt;input type='textbox' id='textbox1' &gt;&lt;/br&gt;
      &lt;label&gt;A. &lt;input type='text' id='Q1choice1'&gt;
      &lt;input type='button' value='Add Option' id='1'&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;input type='button' value='Add Question' id='addQuestion'&gt;
  &lt;input type='button' value='Remove Question' id='removeQuestion'&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>