jQuery > Attribute related method

.addClass() - Add class to element in jQuery

How to add a css class to an element in jQuery?

To add a css class to the html element, addClass() method can be used. 

<script language="javascript" type="text/javascript">

Above code will set the class attribute to "class2" in every “div” element on the web page. 

 Views: 8492 | Post Order: 26

Write for us

Hosting Recommendations