Home > Web Front-end > JS Tutorial > 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中文网
Release: 2016-05-16 15:03:17
Original
2007 people have browsed it

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
}
Copy after login

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)!

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template