JSFiddle - React, Tailwind, and code Playground

by Jon Kittell

HTML

<input type="text" data-bind="value: someProperty"/>
<input type="text" data-bind="value: anotherProperty"/>
<input type="button" value="Save" data-bind="enable: canSave, click: save"/>

JavaScript

function MyVM() {
    var self = this;
    self.someProperty = ko.observable();
    self.anotherProperty = ko.observable();
    self.canSave = ko.computed(function() {
        return false;
    });
    self.save = function() {
        alert("Saved!");
    }
}

var vm = new MyVM();
ko.applyBindings(vm);