jQuery custom function throwing error when no selected elements exist
<p>I have a custom function which disables text selection for the selected elements. The custom function is structured like this:</p>

<pre><code>$.fn.DisableTextSelect = function() {
  return this.each(function() {
    // do things to 'this' element
    // ...
  });
};
</code></pre>

<p>I call it like this, for example:</p>

<pre><code>$("label").DisableTextSelect();
</code></pre>

<p>Problem is, when there are no elements to operate on, instead of just doing nothing, an error is thrown, which Firebug shows as <code>$("label") is null</code> pointing to the line above.</p>

<p><img src="http://i.stack.imgur.com/3I5M8.gif" alt="enter image description here"></p>

<p>Have I written the function incorrectly? If there are no elements found, I thought it would simply return; ie. not perform the each() loop.</p>
