Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include !important in jquery

Tags:

jquery

I am trying to add !important in the css attribute using jQuery like

$("tabs").css('height','650px;!important'); 

but !important has no effect. How to include !important in jquery?

like image 490
Soft Avatar asked Dec 31 '09 17:12

Soft


People also ask

Can we add important in jQuery?

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.

What is $() in jQuery?

$() = window. jQuery() $()/jQuery() is a selector function that selects DOM elements. Most of the time you will need to start with $() function. It is advisable to use jQuery after DOM is loaded fully.

How to add style in jQuery on click?

$(document). ready(function() { $('#div_one'). bind('click', function() { $('#div_two'). addClass('large'); }); });

How do you make a CSS element important?

The ! important rule in CSS is used to add more importance to a property/value than normal. In fact, if you use the ! important rule, it will override ALL previous styling rules for that specific property on that element!


1 Answers

Apparently it's possible to do this in jQuery:

$("#tabs").css("cssText", "height: 650px !important;"); 

Src: http://bugs.jquery.com/ticket/2066

like image 158
klokop Avatar answered Sep 23 '22 00:09

klokop