Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#8916 closed bug (duplicate)

attr('list') return the datalist element, not the attribute value

Reported by: gmoulin.dev@… 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.

Change History (2)

comment:1 Changed 9 years ago by timmywil

Component: unfiledattributes
Priority: undecidedlow
Resolution: duplicate
Status: newclosed

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/

comment:2 Changed 9 years ago by timmywil

Duplicate of #8255.

Note: See TracTickets for help on using tickets.