FMM
FMM

Reputation: 4329

Initial 'checked' state of radio button with jQuery Mobile + knockout.js

I can't seem to figure out why the initial state of my UI doesn't have the first radio button in the 'checked' state. Here's a jsFiddle: http://jsfiddle.net/floyd_may/JcTxT/

However, this jsFiddle here works just fine, even if you modify it to change it to radio inputs (instead of checkbox): http://jsfiddle.net/rniemeyer/EGAH9/

You'd start thinking that perhaps jQuery Mobile has a part to play in all this; however, this version of my original fiddle has the jQuery Mobile portions cut out, and still doesn't work: http://jsfiddle.net/floyd_may/JcTxT/5/

Why isn't the 'child 1' radio button initially appearing checked?

Upvotes: 4

Views: 1341

Answers (1)

Royce Feng
Royce Feng

Reputation: 1663

Rearranging the order of bindings did it: http://jsfiddle.net/JcTxT/6/

value: name, checked: $root.selectedName instead of

checked: $root.selectedName, value: name

Upvotes: 6

Related Questions