title: Knockout: How to do a two-way binding for two number inputs
body: <p>I just recently picked up KO and want to do something similar to the following.</p>
  
  <p>There are two inputs and they change one another.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;input data-bind="value: var1" type="text"&gt;
  &lt;input data-bind-"value: var2" type="text"&gt;
  </code></pre>
  
  <p>Script:</p>
  
  <pre><code>function DataViewModel() {
          var self = this;
          self.price = 5;
          self.var1 = ko.observable(0);
          self.var2 = ko.computed({
              read: function () {
                  if(self.var1() &lt;= 0) {
                      return 0;
                  }
                  return (self.var1 - 1) / self.price;
              },
              write: function (value) {
                  self.var1((Number(value) + 1) * self.price); 
                  // Value = 7.8, output is 44 for var1,
                  // var2 changes to 8.6. Desired is 40 for var1 and 7.8 for var2.
              },
              owner: self
          });
      }
  ko.applyBindings(new DataViewModel());
  </code></pre>
  
  <p>When 40 is inputed into var1, var2 shows 7.8. But when 7.8 is inputed into var2, var1 updates to 44 instead of 40 and the var2 changes to 8.6.</p>
  
  <p>I want var2 to remain what was inputed instead of undergoing the read function.</p>
  
  <p><a href="http://jsfiddle.net/tyq7ejdh/2/" rel="nofollow">http://jsfiddle.net/tyq7ejdh/2/</a></p>