title: Get the value of an <input type="text"> that was created dynamically inside a modal
body: <p>i would like to get the value of an <code>&lt;input type="text"&gt;</code> that was created dynamically inside a modal and put it into variable "newcomment".
  This is how i make the input:</p>
  
  <pre><code>    var newcomment;
      var p = $("&lt;p&gt;");
      p.append("Some text");
      p.append("&lt;/p&gt;");
      p.append("&lt;input type='text'id='comment_text' value='Comment'"+"onblur=newcomment=$('#comment_text').val()"+" onfocus=if(this.value==this.defaultValue)this.value=''&gt;"+"&lt;/input&gt;");
      $("div.modal-body").append(p);
  </code></pre>
  
  <p>The problem is when i write something like "ok" inside the textbox in the modal, and after i focusout from the textbox: newcomment seems not update to "ok" and still have the default "Comment" value.</p>