December 2013
Intermediate to advanced
384 pages
9h 54m
English
$("span").addClass("baseClass");
An important part of rich interactive web pages is good CSS design. JavaScript and jQuery can enhance the CSS design by dynamically adding and removing classes from elements.
jQuery makes it extremely simple to add, remove, and toggle classes on and off. If you design your CSS code well, it’s easy to apply some nice effects.
You add classes using the .addClass(className) method. For example, to add a class named active to all <span> elements, you could use the following statement:
$("span").addClass("active");
Read now
Unlock full access