With jQuery, it is easy to manipulate the CSS of elements.
jQuery has several methods for CSS manipulation. We will look at the following methods:
The following stylesheet will be used for all the examples on this page:
The following example shows how to add class attributes to different elements. Of course you can select multiple elements, when adding classes:
You can also specify multiple classes within the addClass() method:
The following example shows how to remove a specific class attribute from different elements:
The following example will show how to use the jQuery toggleClass() method. This method toggles between adding/removing classes from the selected elements:
The jQuery css() method will be explained in the next chapter.
For a complete overview of all jQuery CSS methods, please go to our jQuery HTML/CSS Reference.
The perfect solution for professionals who need to balance work, family, and career building.
More than 10 000 certificates already issued!
The HTML Certificate documents your knowledge of HTML.
The HTML5 Certificate documents your knowledge of advanced HTML5.
The CSS Certificate documents your knowledge of advanced CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
Your message has been sent to W3Schools.