title: How to test if selector is valid in jQuery
body: <p>I am using AnythingSlider jQuery plugin which dynamically reads the hash in the URL and selects an item on a page via jQuery. The problem is the end user can break the plugin if they get to <a href="http://mydomain.com/#!demos/slider" rel="nofollow">http://mydomain.com/#!demos/slider</a>.</p>
  
  <p>Is there a way to test if a selector is valid instead of letting jQuery crashing (built in function or regex)? See this jsFiddle example that tries to do $('#!demos/slider') and it crashes: <a href="http://jsfiddle.net/PvY2b/" rel="nofollow">http://jsfiddle.net/PvY2b/</a></p>
  
  <pre><code>$('#!demos/slider') &lt;= Uncaught Error: Syntax error, unrecognized expression: #!demo/slider
  </code></pre>