title: How to clear/remove observable bindings in Knockout.js?
body: <p>I'm building functionality onto a webpage which the user can perform multiple times. Through the user's action, an object/model is created and applied to HTML using ko.applyBindings().</p>
  
  <p>The data-bound HTML is created through jQuery templates.</p>
  
  <p>So far so good.</p>
  
  <p>When I repeat this step by creating a second object/model and call ko.applyBindings() I encounter two problems:</p>
  
  <ol>
  <li>The markup shows the previous object/model as well as the new object/model.</li>
  <li>A javascript error occurs relating to one of the properties in the object/model, although it's still rendered in the markup.</li>
  </ol>
  
  <p>To get around this problem, after the first pass I call jQuery's .empty() to remove the templated HTML which contains all the data-bind attributes, so that it's no longer in the DOM. When the user starts the process for the second pass the data-bound HTML is re-added to the DOM.</p>
  
  <p>But like I said, when the HTML is re-added to the DOM and re-bound to the new object/model, it still includes data from the the first object/model, and I still get the JS error which doesn't occur during the first pass.</p>
  
  <p>The conclusion appears to be that Knockout is holding on to these bound properties, even though the markup is removed from the DOM.</p>
  
  <p>So what I'm looking for is a means of removing these bound properties from Knockout; telling knockout that there is no longer an observable model. Is there a way to do this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The basic process is that the user uploads a file; the server then responds with a JSON object, the data-bound HTML is added to the DOM, then the JSON object model is bound to this HTML using</p>
  
  <pre><code>mn.AccountCreationModel = new AccountViewModel(jsonData.Account);
  ko.applyBindings(mn.AccountCreationModel);
  </code></pre>
  
  <p>Once the user has made some selections on the model, the same object is posted back to the server, the data-bound HTML is removed from then DOM, and I then have the following JS</p>
  
  <pre><code>mn.AccountCreationModel = null;
  </code></pre>
  
  <p>When the user wishes to do this once more, all these steps are repeated.</p>
  
  <p>I'm afraid the code is too 'involved' to do a jsFiddle demo.</p>