Side navigation
#8916 closed bug (duplicate)
Opened April 19, 2011 07:50AM UTC
Closed April 19, 2011 01:46PM UTC
Last modified April 19, 2011 01:46PM UTC
attr('list') return the datalist element, not the attribute value
Reported by: | gmoulin.dev@gmail.com | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | attributes | Version: | 1.5.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
With this type of markup :
<input type="text" list="choices">
<datalist id="choices">
<option value="choice">choice</option>
</datalist>
And this jquery code :
$('input').attr('list')
On FF4 and Opera (which implement <datalist>) :
This call return <datalist id="choices"> and not "choices".
So it's impossible to change the attribute value.
It's important to note that "$('input')[0].list" returns also the datalist element and not the attribute value.
On other browsers (which do not implement <datalist>) :
This call return "choices", the attribute value.
For me it's a bug because it differs from all element attributes value get. But with FF4 and Opera behaving in a similar way it can be spec related.
Thanks for taking the time to contribute to the jQuery project!
This has been fixed in the upcoming jQuery 1.6.
http://jsfiddle.net/timmywil/L3V9z/