title: KnockoutJS: applying same ViewModel to multiple divs
body: <p>I have a div that can be duplicated over and over. I want to use KO to bind a new ViewModel instance to every new div instance. I cannot understand how this is possible just by reading the tutorials and going through examples.</p>
  
  <p>Consider this:</p>
  
  <pre><code>&lt;div id="div1"&gt;
      &lt;input data-bind="value: firstName" /&gt;
  &lt;/div&gt;
  &lt;div id="div2"&gt;
      &lt;input data-bind="value: firstName" /&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
      function ViewModel() {
          this.firstName = ko.observable("Test");
      }
  
      ko.applyBindings(new ViewModel());
  &lt;/script&gt;
  </code></pre>
  
  <p>This will bind the input fields on both divs to the <em>same</em> ViewModel object. To rephrase, what I want to do is bind a new instance of the ViewModel to every div.</p>