Question: How to remove class for single tag or single element with jQuery?
$(document).ready(function() { //Use this $("#idName").removeAttr('className'); //OR use this, both will be work same $("#idName").attr('class', ''); });
Any element having id="idName", Its class will be removed.
Element can p, div and p etc.
removeAttr is jQuery's inbuilt function, So you must call this function after loading the jQuery file.
$(document).ready() is used to identify jQuery file loaded.
Question: How to remove class for multiple tags in single line?
$(document).ready(function() { $(".className").removeAttr('className'); });
Any element having className class, "class" will be delete from html tag.
Element can p, div & p etc.
removeAttr is jQuery's inbuilt function, So you must call this function after loading the jQuery file. $(document).ready();, is used to identify jQuery file loaded.
Question: How to remove class for single tag or single element without jQuery?
$(window).load(function() { //Use this document.getElementById('idName').className = ''; });
Any element having idName's class will be removed.
Element can pdiv and p etc.
$(window).load();, is used to identify html is fully loaded.