() { var viewModel = function (value) { this.value = ko.observable(value); this.setValue = ko.computed({ read: this.value, write: function (value) { if (!isNaN(value)) this.value(parseFloat(value)); // Write to underlying storage }, owner: this }); this.disabled = ko.observable(false); }; ko.applyBindings(new viewModel(50)); });
| Value |