Skip to main content

Bug Tracker

Side navigation

#14202 closed bug (worksforme)

Opened July 30, 2013 01:26PM UTC

Closed July 30, 2013 01:44PM UTC

Last modified July 31, 2013 11:56AM UTC

.prop('selected') does not select right option

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:
Description

I hope I did not oversee this...

When using .prop('selected',true) on a select form field, the "selected" param is set, but the selected option is not shown as selected in the drop down. I have to set it using .val() in addition to make the select show up correctly.

FF 22 on Win7

Attachments (0)
Change History (6)

Changed July 30, 2013 01:28PM UTC by dmethvin comment:1

owner: → anonymous
status: newpending

Please provide a test case on jsFiddle, thanks!

Changed July 30, 2013 01:35PM UTC by anonymous comment:2

status: pendingnew

jsFiddle does not have v1.10.2? Seems to work with 1.10.1.

http://jsfiddle.net/aK6nb/

Changed July 30, 2013 01:37PM UTC by anonymous comment:3

Found it, it's unter "2.0.2", I've updated the fiddle.

Changed July 30, 2013 01:39PM UTC by anonymous comment:4

ARGH I'm sorry, I'm not familiar with jsFiddle...

http://jsfiddle.net/aK6nb/2/

But you can see that it works with 1.10.1 (first fiddle).

Changed July 30, 2013 01:44PM UTC by dmethvin comment:5

resolution: → worksforme
status: newclosed

As long as you wait for the document to be ready, as you must, this works fine in both the 1.x and 2.x branches. If you don't wait, the selector selects nothing (it's not there yet) and therefore .prop() has nothing to do.

http://jsfiddle.net/aK6nb/5/

Changed July 31, 2013 11:56AM UTC by anonymous comment:6

Thnx!