How to remove all CSS classes using jQuery,
Remove All classes From Div,
Remove all css from a html element using JQuery or CSS,
jQuery removeClass() Method,
Add and Remove CSS Classes using jquery
Hi guys today i will tell you through this tutorial how we can remove any tags or div class from jquery
First of all, let me explain the code of htc and css and jquery differently.
First of all, you will write the code below given below.
<html> <head> <script src="https://code.jquery.com/jquery-git.js"></script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>How to remove all CSS classes using jQuery</title> </head> <body> <p id="item" class="center large">hi, i am chaurasiya.</p> <input type="button" value="Click to remove all classes" onclick="remove_css_classes()" /> </body> </html>
Then after that you will write this code of css in the same file. Then you can later manage your css file accordingly when your code is tested.
<style> p.center { text-align: center; color: blue; } p.large { font-size: 200%; } </style>
Then you add the given js code as well.
<script> function remove_css_classes() { $("#item").removeClass(); } </script>
If you want, you can also merge this entire code by typing it into an identical file as you can see below.
how-to-remove-all-css-classes-using-jquery.html
<html> <head> <script src="https://code.jquery.com/jquery-git.js"></script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>How to remove all CSS classes using jQuery</title> </head> <body> <p id="item" class="center large">hi, i am chaurasiya.</p> <input type="button" value="Click to remove all classes" onclick="remove_css_classes()" /> </body> </html> <style> p.center { text-align: center; color: blue; } p.large { font-size: 200%; } </style> <script> function remove_css_classes() { $("#item").removeClass(); } </script>