I have a Knockout view model defined like this:
function viewModel () {
var self = this;
self.myName = ko.observable();
self.myValue = ko.observ
Actually, what I want to do can be done inside the view model definition, so I can change my code to this:
function viewModel () {
var self = this;
self.myName = ko.observable();
self.myValue = ko.observable("10");
$('a.treeitem').live("click", function (e) {
e.preventDefault();
self.myValue("20");
});
};
Now everything works fine. Sometimes, the right way really is the easy one.