title: Jquery Error :Microsoft JScript runtime error: Unable to get value of the property 'html': object is null or undefined
body: <p>on my MVC3 razor page,I am trying to dynamically add a textbox with click of a button</p>
  
  <p>Pasted below is my Jquery .But when I click addButton ,I am getting the above error message .</p>
  
  <p>To resolve this error I tried adding  <code>&lt;script type="text/javascript" src="jquery-1.3.2.min.js"&gt;&lt;/script&gt;</code>  ,but still I am getting the same error .Appreciate your suggestions to resolve this error.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  
  
      $(document).ready(function(){
  
  
  
          var counter = 2;
  
  
  
          $("#addButton").click(function () {
  
  
  
              if(counter&gt;10){
  
                  alert("Only 10 textboxes allow");
  
                  return false;
  
              }   
  
  
  
              var newTextBoxDiv = $(document.createElement('div')).attr("id", 'TextBoxDiv' + counter);
  
                  newTextBoxDiv.after().html('&lt;label&gt;Textbox #'+ counter + ' : &lt;/label&gt;' +
  
                  '&lt;input type="text" name="textbox' + counter + 
  
                  '" id="textbox' + counter + '" value="" &gt;');
  
  
  
              newTextBoxDiv.appendTo("#TextBoxesGroup");
  
  
  
              counter++;
  
          });
  
  
  
          $("#removeButton").click(function () {
  
              if(counter==1){
  
                  alert("No more textbox to remove");
  
                  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;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/2338X.png" alt="enter image description here"></p>