Answer the question
In order to leave comments, you need to log in
How to remove specific css rule from style attribute?
I add
The style attribute changes. And how to remove the added styles?
If you put some value of type none, then it starts to overlap the value from the class.
Is there any way to do without reading attr('style') and writing it back after "manual" clearing?
$('...').css('prop', 'value')
Answer the question
In order to leave comments, you need to log in
// jQuery
$("#element").css("width", "");
// Native
document.querySelector("#element").style.width = "";
It seems to me that we need to play less with this addition of styles. It is much more convenient to add a css class defined in advance:
And then, if necessary, remove the class:$('...').removeClass('my-class');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question