snippetjavascriptCritical
How can I remove a style added with .css() function?
Viewed 0 times
addedwithhowfunctionstyleremovecsscan
Problem
I'm changing CSS with jQuery and I wish to remove the styling I'm adding based on the input value:
How can I do this?
Note that the line above runs whenever a color is selected using a color picker (ie. when the mouse moves over a color wheel).
2nd note: I can't do this with
I just want to remove the
if(color != '000000') $("body").css("background-color", color); else // remove style ?How can I do this?
Note that the line above runs whenever a color is selected using a color picker (ie. when the mouse moves over a color wheel).
2nd note: I can't do this with
css("background-color", "none") because it will remove the default styling from the CSS files.I just want to remove the
background-color inline style added by jQuery.Solution
Changing the property to an empty string appears to do the job:
$.css("background-color", "");Code Snippets
$.css("background-color", "");Context
Stack Overflow Q#4036857, score: 1442
Revisions (0)
No revisions yet.