I am trying to add !important in the css attribute in jQuery like
$("tabs").css('height','650px;!important');
but There is no effect of !important. How to include !important in jquery?
I am trying to add !important in the css attribute in jQuery like
$("tabs").css('height','650px;!important');
but There is no effect of !important. How to include !important in jquery?
You don't need !important
when modifying CSS with jQuery since it modifies the style
attribute on the elements in the DOM directly. !important
is only needed in stylesheets to disallow a particular style rule from being overridden at a lower level. Modifying style
directly is the lowest level you can go, so !important
has no meaning.
While i think you don't need !important in your code "at least in normal cases" because using your code that means that jquery will add inline css style which is more power than any other class and no need for !important in this case.
But i think to make it work as you want, just put !important then the semicolon.
$("tabs").css('height','650px !important;');
Also note something in your code, what "tabs" is? is it a tag? "don't think so"
if its a class you need to write it like this:
$('.tabs')
and if its an id you need to write it like this:
$('#tabs')
Apparently it's possible to do:
$("#tabs").css("cssText", "height: 650px !important;");