Bug Tracker

Opened 11 years ago

Last modified 10 years ago

#8512 closed enhancement

jQuery("SELECT").val(null) : inconsistent results in different browsers — at Initial Version

Reported by: shehriyari Owned by:
Priority: low Milestone: 1.next
Component: attributes Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:

Description

http://jsfiddle.net/jf7t2/1/

Please run it on the latest versions of all browsers, and see for yourself. When the button is clicked, on:

  1. on WebKit browsers (Chrome, Safari) it just doesn't select anything, instead creates some ghostly empty option
  2. on Firefox and Opera, it works the way I expect and want it to work, de-selects all options of the element
  3. on Explorer, it does nothing

jQuery 1.5.1 source code also tells us that, in this case jQuery sets selectedIndex = -1.

http://stackoverflow.com/questions/5286424/jqueryformelement-valnull-inconsistent-results-in-different-browsers/5286643#5286643

But since browsers mess it up in this case. Shouldn't jQuery force it to behave the way Firefox and Opera does, de-select all child options?

Thanks.

Change History (0)

Note: See TracTickets for help on using tickets.