In CSS !important
is used to increase the priority of a CSS property. This ignores the overriding properties.
In jQuery, you can use the css()
method to manipulate style property of the selector but this doesn’t allow to set !important
to property.
For example –
$('#txt').css('width', '100px !important');
The above code doesn’t work when you run it.
In this tutorial, I show how you can add !important
to CSS property with jQuery.