Bug Tracker

Opened 14 years ago

Closed 12 years ago

Last modified 12 years ago

#5394 closed bug (duplicate)

Discrepancy of $(...).val(missing_option) bevahiour between IE, FF and Safari

Reported by: olksy Owned by: olksy
Priority: low Milestone:
Component: attributes Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:


This ticket is about SELECT control behavior.

missing_option is option that is not in SELECT's option list.

In FF, IE $( select ).val( missing_option ) will not change the selection.

In Safari that will cause selecting non-existent blank option. Then, if I as user select any existing option back, blank option goes away.

I have no idea, which behavior is preferred. But it would be nice to have consistency.

Safari is 4.0.3

Change History (6)

comment:1 Changed 14 years ago by dmethvin

These edge cases can take a lot of code to nail down but don't seem that common. If there isn't a clear "right way" to do it, perhaps the best thing to do would be to explicitly specify the behavior you want for that case. Otherwise even if jQuery tried to normalize all the browser behaviors it might not do it the way you require, and you'd be back to writing explicit code to handle the case.

comment:2 Changed 13 years ago by dmethvin

Component: unfiledattributes

comment:3 Changed 13 years ago by snover

Owner: set to olksy
Status: newpending

Could you please confirm this is still an issue in the current version of jQuery?

comment:4 Changed 13 years ago by dmethvin

Status: pendingopen


Firefox, IE, and Opera return the first element's value when an invalid value is assigned; Safari and Chrome return null for the value.

comment:5 Changed 12 years ago by Timmy Willison

Priority: minorlow
Resolution: duplicate
Status: openclosed
Type: enhancementbug

comment:6 Changed 12 years ago by Timmy Willison

Duplicate of #8813.

Note: See TracTickets for help on using tickets.