JSFiddle - React, Tailwind, and code Playground
HTML
<input data-bind="value: loginText, valueUpdate: 'afterkeydown'">
<input type="password" data-bind="value: passwordText, valueUpdate: 'afterkeydown'">
<button data-bind='click: makeWrong'>Make it wrong</button>
<div class="alert alert-danger" data-bind="visible: isError">Something is wrong</div>
JavaScript
function User() {
var self = this;
self.loginText = ko.observable(null);
self.passwordText = ko.observable(null);
self.isError = ko.observable(false);
self.makeWrong = function(){
self.isError(true);
}
ko.computed(function() {
debugger;
self.loginText();
self.passwordText();
self.isError(false);
});
}
ko.applyBindings(User);