Skip to main content

Bug Tracker

Side navigation

#7438 closed bug (invalid)

Opened November 08, 2010 07:01PM UTC

Closed November 08, 2010 07:44PM UTC

Last modified March 13, 2012 06:44PM UTC

$(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

Attachments (0)
Change History (5)

Changed November 08, 2010 07:07PM UTC by boushley comment:1

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 "".

Changed November 08, 2010 07:09PM UTC by boushley comment:2

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

Changed November 08, 2010 07:44PM UTC by snover comment:3

resolution: → invalid
status: newclosed

Invalid as per boushley’s comments.

Changed November 09, 2010 12:42AM UTC by anonymous comment:4

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.

Changed November 22, 2010 04:04AM UTC by snover comment:5

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