jQuery addClass()

jQuery addClass() method adds one or more class to the matched elements.To add more than one class use separate class name with spaces.

Syntax

jQuery.addClass(className) jQuery.addClass(className className2 className3)

Add Class in p element using jQuery.

HTML
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script>
<title>jQuery addClass() Example </title>
<style type="text/css">
.mycssClass {
    color: LawnGreen;
  }  
</style>
</head>
<p>Hello, Friends how are you ? </p>
</html>
Javascript
$(document).ready(function(){
$( "p" ).addClass( "mycssClass" ); 
});