jQuery hasAttr checking to see if there is an attribute on an element
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1097522/check-existence-of-an-attribute-with-jquery">Check existence of an attribute with JQuery</a>  </p>
</blockquote>



<p>How do you check if there is an attribute on an element in jQuery? Similar to <code>hasClass</code>, but with <code>attr</code>?</p>

<p>For example, </p>

<pre><code>if ($(this).hasAttr("name")) {
    // ...
}
</code></pre>
