I've got a structure like this:
<div id='col1'> ... some ko elements ... </div>
<div id='col2'></div>
<div id='col3'> ... some more ko elements ... </div>
... and I need to be able to ko.applyBindings
to col1
and col3
. Right now, I'm doing something like this to bind to col1
:
ko.applyBindings(myViewModel, document.getElementById("col1"));
That works fine to populate the first column. But I still lack the third column. I'd love to be able to do this:
<div id='col1' class='bindable'> ... some ko elements ... </div>
<div id='col2'></div>
<div id='col3' class='bindable'> ... some more ko elements ... </div>
And then...
ko.applyBindings(myViewModel, $(".bindable"));
... so that it attempts to bind to all instances of .bindable
. Is there anything like this in knockout, or do you have any suggestions?