Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#14202 closed bug (worksforme)

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


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

Change History (6)

comment:1 Changed 10 years ago by dmethvin

Owner: set to anonymous
Status: newpending

Please provide a test case on jsFiddle, thanks!

comment:2 Changed 10 years ago by anonymous

Status: pendingnew

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


comment:3 Changed 10 years ago by anonymous

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

comment:4 Changed 10 years ago by anonymous

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


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

comment:5 Changed 10 years ago by dmethvin

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.


comment:6 Changed 10 years ago by anonymous


Note: See TracTickets for help on using tickets.