Tag Archives: jQuery addClass Syntax

jQuery addClass Method


jQuery addClass Method : is used to add class(es) to the selected elements.


jQuery addClass Method Syntax

$(selector).addClass(classname,function(index,currentClassName));

index: (Interger) Index of the current element in the current set.
currentClassName(String)Current Class name in the matching set.

jQuery addClass() Method Example 1


Try it »

jQuery addClass() Method Example 2


Try it »

Output

jQuery addClass Method

jQuery addClass Example