title: jquery add value to dynamically created input text field
body: <p>I have a set of dynamically create input text boxes created via jQuery ajax and need to populate certain fields with values. I am using this;</p>
  
  <pre><code>$('#priority').attr('value', tplData);
  </code></pre>
  
  <p>but that does not seem to be working.</p>
  
  <p>I tried .val(tplData), but to no avail.</p>
  
  <p>Is there a different way to set the values of fields, via jQuery, that have been created dynamically?</p>
  
  <p>The input field html is as follows;</p>
  
  <pre><code>&lt;div class="field-container"&gt;
    &lt;!-- This field is being dynamically created via an ajax call using jQuery --&gt;
    &lt;input type="text" name="priority" id="priority" class="input-group vert-spacer-bottom" placeholder="Priority"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Many thanks in advance.</p>
  
  <p><strong>EDIT</strong>
  It seems to definitely be something with dynamically create elements, because if I create the input element statically in the HTML and try these suggestions, it works perfect. But if the input fields are created dynamically, no dice.</p>