#9071 closed bug (fixed)
$('<option></option>').val('myValue') no longer sets value
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.6.1 |
Component: | attributes | Version: | 1.6 |
Keywords: | Cc: | Timmy Willison | |
Blocked by: | Blocking: |
Description
jQuery 1.6 is not setting the 'value' attribute of an <option> element when using the .val() function.
With the following code
$('<option />').val('48a1b555-4015-498d-ac91-78aab2872364')
jQuery 1.5.2 gives a result of
<option value="48a1b555-4015-498d-ac91-78aab2872364"></option>
jQuery 1.6 gives a result of
<option></option>
A workaround for the issue is to use
$('<option />').attr('value', '48a1b555-4015-498d-ac91-78aab2872364')
This has been reproduced on IE7 and Chrome.
Change History (4)
comment:1 Changed 12 years ago by
Cc: | Timmy Willison added |
---|---|
Component: | unfiled → attributes |
Status: | new → open |
comment:2 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fix setting value attributes on option elements. Fixes #9071.
Changeset: 4ac2fdda2c26e9b64502b9ef50748427bed2f3c6
comment:3 Changed 12 years ago by
Made this JSFiddle before realizing the ticket was fixed: http://jsfiddle.net/Fg8xL/1/
Will this fix make it into 1.6.1?
comment:4 Changed 12 years ago by
Milestone: | 1.next → 1.6.1 |
---|---|
Priority: | undecided → high |
Yes it will: http://jsfiddle.net/timmywil/Fg8xL/2/
Note: See
TracTickets for help on using
tickets.
Confirmed. cc'ing timmywil