javascript - Knockout bind input text box to another text box -
I have two input tags and when I type in one, I want the exact same value in both of the knockout I am experimenting with it and thinking how I will fulfill it.
& lt; Input type = "text" data-bind = "value: theValue" /> & Lt; Br / & gt; & Lt; Input type = "text" data-bind = "value: the value" /> & Lt; Script type = "text / javascript" & gt; Var VisualModel = {theValue: Ko.SourceWeb ("Default Text"),}; Ko.applyBindings (see new modell ()); & Lt; / Script & gt;
Whatever you have, you just want to add valueUpdate: ' The above version in your binding ' so that you can update as your type. & lt; Input type = "text" data-bind = "value: theValue, valueUpdate: 'afterkeydown'" /> & Lt; Br / & gt; & Lt; Input type = "text" data-bind = "value: theValue, valueUpdate: 'afterkeydown'" /> In addition, ko.applyBindings (see new modell ()); should be ko.applyBindings (viewModel); This is a
Comments
Post a Comment