title: jQuery - Check if DOM element already exists
body: <p>I am trying to add some form elements dynamically via Ajax with jQuery.
  I want to make sure that I don't create the same element twice, so I only want to add it if it hasn't already been added to the DOM.</p>
  
  <p>All of my elements have a unique CSS id, for example:</p>
  
  <pre><code>$('#data_1')
  </code></pre>
  
  <p>I am using the following to check if the element already exists:</p>
  
  <pre><code>if ($('some_element').length == 0) {
      //Add it to the dom
  }
  </code></pre>
  
  <p>However, it only works for elements which were already part of the page when it first loaded. </p>
  
  <p>How do I also check for elements which were dynamically created after the page was loaded?</p>
  
  <p>Any advice is appreciated.</p>
  
  <p>Thanks.</p>