JSFiddle - React, Tailwind, and code Playground
HTML
<textarea data-bind="value: comment, valueUpdate: 'afterkyedown'"></textarea>
<br/><br/>
<span data-bind="text: getCount, valueUpdate: ['afterkeydown','propertychange','input']"></span> characters
JavaScript
var viewModel = function(){
var self = this;
self.count = ko.observable(0);
self.comment = ko.observable("");
self.getCount = function(){
var countNum = 10 - self.comment().length;
self.count(countNum);
};
}
var viewModel12 = new viewModel();
ko.applyBindings(viewModel);