I have a list of checkboxes, which hide and display a number box when clicked.
Here’s the JSfiddle of that working: http://jsfiddle.net/bjornmann/yXUqf/3/
the basic idea is:
$('.numberthing').each(function(){push the data to an array here.})
Then I said “let’s learn knockout and move this whole app into that framework”
so that’s when the bottom dropped out.
I have a list of items (the checkboxes) pushing to an array, and then a ko foreach in the view,
but I’m lost on how to add in the data from the number box.
I’m having a hell of a time figuring out how to bind the value of an input to the value of the checkbox in an array in knockout.
Bindings in KO are two-way; If you update the view model, the UI gets updated. If you update the bound controls, the view model gets updated.
You can also make computed properties, which gets updated whenever any referenced observables gets updated.
http://jsfiddle.net/MizardX/zHTRP/