.addClass( className ) :- Adds the specified class(es) to each of the set of matched elements

.addClass() method is used to add class to some elements.

Example :-


.myclass { color:red; font-size:25px; }

.paragraph { color:blue; font-size:20px; }


<script type=”text/javascript” src=”http://code.jquery.com/jquery-1.5.js”></script&gt;

<script type=”text/javascript”>

$(document).ready(function (){





<div align=”center”>I am div1</div>

<p align=”center”>I am paragraph</div>

<div align=”center”>I am div2</div>

Output :-

I like to hear from you about this !!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.