if ($("#custom-tabContent")[0])
ko.cleanNode($("#custom-tabContent")[0]); // remove any knockout bindings that might be on these DOM elements
if (url != "") {
$("#custom-tabContent").load(url, data, function () {
if (typeof window[name + 'viewModel'] != 'undefined') //if a viewmodel with the tab name is defined, use that one instead
ko.applyBindings(window[name + 'viewModel'], document.getElementById("custom-tabContent"));
else
ko.applyBindings(viewModel, document.getElementById("custom-tabContent"));
});
}
I am using 2.3.0.min.js final one...
Basically I am using jquery to load content into a tab then bind onto it once it is loaded. When I load new content in, which could be a completely different tab/model and therefore this section of the page needs to be bound again, I want to make sure I unbind from that section of the page, but I am not having luck doing this.
If anyone can offer any tips/suggestions on how to unbind from a element that would be appreciated. Please don't say 'rewrite your app so it dosn't need to unbind from an element'. Yes obviously I can do that but that isn't helpful/practical.
Would it help if I delete the entire element altogether and recreate it? Thoughts?
Thanks,
Enis