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

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -