Category: jQuery Questions

How To Remove CSS Class Using jQuery

To remove CSS class using jQuery, you only need to use removeClass method.  In the sample code given below, we are removing CSS class myStyle from DIV element using function divClass(). <!DOCTYPE html> <html> <head> <title>jQuery Tutorial </title> <script src="http://code.jquery.com/jquery-latest.js"></script> <!-- CSS Class --> <style type="text/css"> .myStyle { background-color:red; color:white; font-weight: bold; } </style> <!--

How To Add CSS Class Using jQuery

To 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> <html> <head> <title>jQuery Tutorial </title> <script src="http://code.jquery.com/jquery-latest.js"></script> <!-- CSS Class --> <style type="text/css"> .myStyle { background-color:red; color:white; font-weight: bold; } </style>