How to remove all CSS classes from an element using JQuery


There are many solutions to remove all CSS classes from an HTML element using JQuery.

$("#item").removeClass();
$("#item").removeAttr('class');
$("#item").attr('class', '');
$('#item')[0].className = '';

If you are not using JQuery, then you can use following JavaScript based solution:

document.getElementById('item').className = '';

 

 

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Comments