AJAX
Basics
Data
DOM
Effects
Events
Forms
jQuery UI
Plug Ins
Traversing
To add and/or remove a CSS Class from a page element, use this:
$("#btnTest").removeClass();
$("#btnTest").addClass("btn btn-danger");
The code above will remove the btn-primary class from the button and adds the btn-danger class. If you do not provide the removeClass function with any arguments (class names) then it will remove all CSS classes. If you provide it with one or more class names, it will only remove those specified classes.
The css()
method sets or returns one or more style properties for the selected elements.