For binding a property in the server's view-model to a JavaScript property at the client side, you can use my WebBinding.
In the client side, you can affect the HTML element according to the JavaScript property. For instance, you can use a JavaScript MVC library (like: AngularJS ng-class or, Knockout css binding, etc...) to toggle class with someting like this Simple HTML Toggle Button.