jQuery Remove Class

jquery jQuery Remove Class Jquery Functions

How can we remove the class in the HTML tag using jQuery?

Sometime we want to remove the class under some condition on document ready or on document load. It is very simple in the jQuery to remove the Class from the HTML tag. We can remove the class in the HTML tag using jQuery function removeClass().

Syntax of jQuery function removeClass()

$('TagSelector').removeClass('Class-Name'); Let's we make the CSS class with black color and with red background and apply this class.

On click button remove CSS class my-class using jQuery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <style type="text/css"> .my-class{ color:black; background-color: red; padding: 5px; } </style> <button id="mybutton">Click To Remove my-class from div</button> <div class="my-class" id="mydiv">Write Less ,Do More With jQuery</div> <script> $("#mybutton").click(function(){ $("#mydiv").removeClass('my-class'); }); </script>

Output of jQuery functions removeClass()

Write Less ,Do More With jQuery
jquery Jquery Functions Chapter Next »