jquery hasAttr checking to see if there is an attribute on an element

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2009-08-23T08:38:52Z Indexed on 2010/05/25 8:31 UTC
Read the original article Hit count: 421

Filed under:

How do you check if there is an attribute on an element in jquery? Similar to hasClass but with attr?

For example,

if ($(this).hasAttr("name")) {
    function etc()
}

Thanks.

© Stack Overflow or respective owner

Related posts about jQuery