Home  >  Article  >  Web Front-end  >  How to use jquery to modify the style attribute with !important in css_jquery

How to use jquery to modify the style attribute with !important in css_jquery

PHP中文网
PHP中文网Original
2016-05-16 15:03:171975browse

How to use jquery to modify the style attributes with !important in css_jquery

Use jquery to modify the style attributes with !important in css

External style For:

p.test{
  width:auto !important;
  overflow:auto !important
}

via $("p.test").css("width","100px"); and $("p. test").css("width","100px !important"); is invalid

To modify the width of p, you can use the following method:

$("p.test").css("cssText", "width:650px !important;"); If you want to modify multiple attributes, you can do this:

$("p.test").css("cssText", "width:650px !important;overflow:hidden !important");

The above is how to use jquery to modify the style with !important in css Attribute_jquery content, for more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn