Side navigation
#6737 closed bug (wontfix)
Opened June 28, 2010 03:20PM UTC
Closed October 31, 2010 02:09AM UTC
Last modified February 11, 2011 04:57AM UTC
.attr() does not return "undefined" in IE6/7 for an undefined attribute
Reported by: | Beeper | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.4.3 |
Component: | attributes | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
On an input-element i want to check an attribute for existence.
so i have something like: $('#id').attr('src') !== undefined
Here is the working example for Jquery 1.3.2:
Here is the Bug:
It seems to apply only for some HTML-Elements. I tried 'p' and .attr works fine, but for input-elements it returns "" and not "undefined".
Attachments (0)
Change History (4)
Changed June 29, 2010 12:52AM UTC by comment:1
Changed October 31, 2010 02:09AM UTC by comment:2
keywords: | → docfix |
---|---|
priority: | → low |
resolution: | → wontfix |
status: | new → closed |
This is not a bug, please see post by dmethvin
Changed November 02, 2010 01:27AM UTC by comment:3
keywords: | docfix → needsdocs |
---|
Changed February 11, 2011 04:57AM UTC by comment:4
keywords: | needsdocs |
---|
Docs updated: http://api.jquery.com/attr/
For attributes that mirror properties on specific DOM elements, such as the
attribute on a checkbox or radio button, will return a non- value.The best cross-browser way to approach this is to check for a falsy value using
rather than checking for a particular value.