kokoko

by antishok

HTML

<textarea data-bind="event: {focus: setActive, blur: setInactive}, css: {red: active}">hehe</textarea>

CSS

.red {
    border:2px solid red;
    background-color: #f78;
}

JavaScript

function VM() {
    var self = this;
    this.active = ko.observable(false);
    this.setActive = function() {
        self.active(true);
    }
    this.setInactive = function() {
        self.active(false);
    }
}


ko.applyBindings(new VM());