How To Add CSS Class Using jQuery

jqueryTo add CSS class using jQuery, you only need to use addClass method.  In the sample code given below, we are adding CSS class myStyle to a DIV element using function divClass().

<!DOCTYPE html>
<title>jQuery Tutorial </title>

<script src=""></script>

<!-- CSS Class --> 
<style type="text/css">
    font-weight: bold;    
 <!-- jQuery Code to add CSS Class -->
<script type="text/javascript">
 function divClass(){

<input type="button" value="Add Class" onclick="divClass()"/>
<br />
<br />
<div id="divHello" >
Hello World!