Here's my fiddle:
I'm trying to make the side editable if I click on the text. I'm following this example from the knockout site:
view:
<p>
Name:
<b data-bind="visible: !editing(), text: name, click: edit"> </b>
<input data-bind="visible: editing, value: name, hasfocus: editing" />
</p>
<p><em>Click the name to edit it; click elsewhere to apply changes.</em></p>
script:
function PersonViewModel(name) {
// Data
this.name = ko.observable(name);
this.editing = ko.observable(false);
// Behaviors
this.edit = function() { this.editing(true) }
}
ko.applyBindings(new PersonViewModel("Bert Bertington"));
http://knockoutjs.com/documentation/hasfocus-binding.html
When I click on the text of a "side", I hit the "edit" function, but the visibility of the divs doesn't change. I think this is a scoping issue but I don't know how to troubleshoot it.