title: jQuery find if div with id=X exists inside a DOM string
body: <p>I'm trying to check if a div with an id exists in a string holding some html, so I'm looking for a function that returns true or false. </p>
  
  <p>There's a function hasClass that checks if a div has a certain class</p>
  
  <pre><code>$('#mydiv').hasClass('bar')
  </code></pre>
  
  <p>I guess what I'm looking for is something like</p>
  
  <pre><code>var mystring = "some string with html";
  
  mystring.hasId('lookingforthisid');
  </code></pre>
  
  <p>How can I check this?</p>