Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#9071 closed bug (fixed)

$('<option></option>').val('myValue') no longer sets value

Reported by: kkalitowski@… Owned by:
Priority: high Milestone: 1.6.1
Component: attributes Version: 1.6
Keywords: Cc: Timmy Willison
Blocked by: Blocking:


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


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 Rick Waldron

Cc: Timmy Willison added
Component: unfiledattributes
Status: newopen

Confirmed. cc'ing timmywil

comment:2 Changed 12 years ago by Timmy Willison

Resolution: fixed
Status: openclosed

Fix setting value attributes on option elements. Fixes #9071.

Changeset: 4ac2fdda2c26e9b64502b9ef50748427bed2f3c6

comment:3 Changed 12 years ago by ljharb@…

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 Timmy Willison

Milestone: 1.next1.6.1
Priority: undecidedhigh
Note: See TracTickets for help on using tickets.