JSFiddle - React, Tailwind, and code Playground
by darknessm0404
HTML
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<div id="abc" data-bind="style:{backgroundColor:obsLink.externalObservable}">
ABC
</div>
<a data-bind="click:clicked">Click here</a>
JavaScript
var MyViewModel = function() {
var self = this;
this.clicked = function(){
self.obsLink(otherSimulatedInvisibleViewModel.otherObservable);
};
this.obsLink = ko.observable(); // undefined => not linked to another property yet
};
var otherSimulatedInvisibleViewModel = { externalObservable: ko.observable('#00FF00')};
ko.applyBindings(new MyViewModel());