title: How do I check if a tab exists in jQuery UI?
body: <p>Currently I use this to check if a tab(element) already exists:</p>
  
  <pre><code>if(!$('#'+element).length){
     //... code to add new tab if not exists.
  } else {
     Alert("Tab or portlet already exists...");
  }
  </code></pre>
  
  <p>This is very dirty and I get a "uncaught exception: Syntax error, unrecognized expression: #" from FireBug. If element already exists, the "Alert" doesn't show, I think it hangs at the first exception.</p>
  
  <p>Is there a better way to check if an element exists? (Or a tab)</p>
  
  <p>I am using this for my personal project @ <a href="http://www.soliman.nl/test/jqueryui/ui_2.php" rel="nofollow noreferrer">http://www.soliman.nl/test/jqueryui/ui_2.php</a></p>