JSFiddle - React, Tailwind, and code Playground

HTML

<div>
    <input type="text" data-bind="enable: !isReadonly()" value="Some Value" />
    <button data-bind="click: readonly">Readonly/NotReadonly</button>
</div>

JavaScript

var ViewModel = function() {
    var self = this;
    self.isReadonly = ko.observable(false);
    self.readonly = function() {
        self.isReadonly(!self.isReadonly());
    }
}

ko.applyBindings(new ViewModel());