title: How to check if an element with id exists or not in jQuery?
body: <p>I'm generating a div dynamically and I've to check whether a dynamically generated div exists or not ? How can I do that?</p>
  
  <p>Currently I'm using the following which does not detects the div generated dynamically. It only detects if there is already an element with the id contained in the HTML template.</p>
  
  <pre><code>$(function() {
      var $mydiv = $("#liveGraph_id");
      if ($mydiv.length){
          alert("HHH");
      }
  });
  </code></pre>
  
  <p>How can I detect the dynamically generated div?</p>