ericmbarnard/Knockout-Validation — Issue #10: Adding 'error' class to the invalid form element
Author: iabdulin
Created: 2012-01-24 22:32:17+00:00
State: open

I added this feature by adding custom binding and applying it on line 189

```
ko.applyBindingsToNode(element, { errorClass: valueAccessor()});
```

and later on line 286

```
ko.bindingHandlers.errorClass = { // add/remove 'error' class to the element
update: function (element, valueAccessor) {
var obsv = valueAccessor();
obsv.extend({ validatable: true });
if (obsv.isValid()) {
$(element).removeClass('error')
} else {
$(element).addClass('error')
}
}
};
```

I am sure u can implement this feature in the nicier way, I am just learning javascript :)