JSFiddle - React, Tailwind, and code Playground

by Rene Rubio

HTML

<div data-bind="css: { highlighted: highlight }, click: toggleHighlight">
    random string
</div>

CSS

.highlighted {
    color: #a52a2a;
    font-weight: bold;
}

JavaScript

function ViewModel() {
    var self = this;
    self.highlight = ko.observable(true);   
    self.toggleHighlight = function () { self.highlight(!self.highlight()) };
}

ko.applyBindings(new ViewModel());