I have a CSS property that was set in a stylesheet file:
.main-outer-div-filter {
max-height: 230px;
}
I am trying to remove it with jQuery like so:
$('.main-outer-div-filter').css('max-height','');
For some reason, this way doesn't seem to have any affect, it only works if I set the style inline, but not when it is in the CSS file. Is there any way to use jQuery to reset/remove CSS properties, which were set in a CSS file?
Thank you
.css()method adds inline style to the matched elements. Since the specificity value of inline style is higher than any CSS selectors, it should get applied actually. I suggest you have a look to your web browser devtools to figure it out. As an aside, in the context of CSS it is called a property, not an attribute.document.styleSheetsobject (along with its methods). But jQuery doesn't provide any tools for that. Therefore you should do it with pure JavaScript.