JSFiddle - React, Tailwind, and code Playground

by nyothecat

HTML

<div id="koRoot">
    <input type='text' data-bind='value: b'/>
    <input type='text' data-bind='value: c'/>
</div>

JavaScript

var a = ko.observable({
    b: ko.observable(),
    c: ko.observable()
});

for (var prop in a()) {
    if (ko.isObservable(a()[prop])) a()[prop].subscribe(function () { a.valueHasMutated() });
}

a.subscribe(function(){
    alert('changed');
});

a().b('bar');
a().c('baz');

ko.applyBindings(a, document.getElementById("koRoot"));