Alex Rivera | Logout

How is jquery used to check for the 'disabled' attribute on an <a> tag?

Asked 2012-04-17T20:12:04.863
38

I have a disabled='disabled' attribute on an <a> tag. How do I test to see if this attribute is on my tag using jquery? The following code returns undefined. I can see the disabled attribute on the tag in firebug and all other attributes on the anchor return successfully using the same syntax. I realize disabled is a custom attribute for an <a> tag.

$('#anchorID').attr('disabled');
Edit
Report

1 Answer

61

Try

$('#anchorID').is('[disabled=disabled]')

Will return true if disabled="disabled" is an attribute for the element.

answered 2012-04-17T20:15:53.990

Your Answer