Remove all CSS classes using jQuery.
<!DOCTYPE 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>Remove all CSS classes using jQuery</title> </head> <body> <p id="item" class="center large">This paragraph refers two classes.</p> <input type="button" value="Click to remove all classes" onclick="remove_classes()" /> </body> </html>
CSS Code:
p.center { text-align: center; color: blue; } p.large { font-size: 200%; }
JavaScript Code:
function remove_classes() { $("#item").removeClass(); }
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
CSS Code:
JavaScript Code: