.addClass() Method

Syntax

$(selector).addClass(class)

Description

addClass() method is used to add or insert a CSS class to a specified element It only adds class event to the selected elements and will not replace or remove the existing class Multiple classes can be added to an element, seperating the class names with space. The below example shows you how to add a css class to a paragraph element.

Example Code

Result:

Welcome to Hscripts.com

Hscripts is praised as best free webmaster resources online, by our users.

Free website content that help to develop, build, promote and maintain a web site.




Ask Questions

Ask Question