I have a Knockout view model defined like this:
function viewModel () { var self = this; self.myName = ko.observable(); self.myValue = ko.observ
You can save the view model as a variable like this:
window.vm = new viewModel(); ko.applyBindings(vm); $('a.treeitem').live("click", function (e) { e.preventDefault(); window.vm.myValue("20"); });
Whenever you read from window.vm you'll be reading from that actual instance of the viewModel object
window.vm