[Solved-6 Solutions] jQuery remove style added with .css() function - javascript tutorial



Problem:

How to remove a style added with .css() function?

Solution 1:

In javascript one of the function as remove_style. Using this function to remove what to be applied.

function remove_style() {
$("#MyInput").css("border", "0");
}

Solution 2:

An empty string to be appear by changing this property.

$.css("background-color", "");

Solution 3:

All style attribute to be removed.

removeAttr( 'style' );

We want to remove all dynamic style and return back to the stylesheet.

Solution 4:

Using javascript to remove style attribute.

var bodyStyle = document.body.style;
if (bodyStyle.removeAttribute)
    bodyStyle.removeAttribute('background-color');
else        
    bodyStyle.removeProperty('background-color');

Solution 5:

jQuery functions used to remove style attribute:

$("#element").removeAttr("style");
$("#element").removeAttr("background-color") 

Solution 6:

Using this command entire tag to be removed:

  $("body").removeAttr("style");


Related Searches to jQuery remove style added with .css() function - javascript tutorial