Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#7438 closed bug (invalid)

$(select).val('') sets last blank as selectedIndex AND $(select).val('') wipes select if no blank values

Reported by: anonymous Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:

Description

http://jsfiddle.net/ju8pz/

For both select boxes, first option should be selected

Change History (5)

comment:1 Changed 9 years ago by boushley

The second select box is properly selecting nothing since according to the W3C the value attribute of an option "specifies the initial value of the control. If this attribute is not set, the initial value is set to the contents of the OPTION element". So there are no elements in that select box who's value is "".

comment:2 Changed 9 years ago by boushley

Sorry, link for my W3C quote is here http://www.w3.org/TR/html401/interact/forms.html#h-17.6

comment:3 Changed 9 years ago by snover

Resolution: invalid
Status: newclosed

Invalid as per boushley’s comments.

comment:4 Changed 9 years ago by anonymous

I'll give you that, but both cases are still wrong:

The 1st select box selects the 2nd option of value "", very counter-intuitive.

the 2nd select box is actually CLEARED, completely unexpected behavior.

comment:5 Changed 9 years ago by snover

Just because the result is unexpected doesn’t mean it is wrong, however. :) .val won’t be changed from its current behaviour.

Note: See TracTickets for help on using tickets.