Knockout binding css class to an observed model property
For this situation you can do: <div data-bind=”attr: { ‘class’: selectedPriority}”> The only downside to this method is that it will set the class directly rather than toggle a class on or off, so if you are using multiple classes, then selectedPriority would need to contain the complete list of classes.