JQuery uses the CSS () method to set multiple styles for a specified element at the same time.
This article mainly introduces jQuery's method of setting multiple styles for a specified element at the same time using the CSS () method. The example shows how to use the css method in jQuery, which is very useful, for more information, see
This example describes how jQuery uses the CSS () method to set multiple styles for a specified element at the same time. Share it with you for your reference. The details are as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<! DOCTYPE html> <Html> <Head> <Script src = "js/jquery. min. js"> </Script> <Script> $ (Document). ready (function (){ $ ("Button"). click (function (){ $ ("P" ).css ({"background-color": "blue", "font-size": "14px "}); }); }); </Script> </Head> <Body> <H2> This is a heading <P style = "background-color: # ff0000"> This is a paragraph. </p> <P style = "background-color: #00ff00"> This is a paragraph. </p> <P style = "background-color: # 0000ff"> This is a paragraph. </p> <P> This is a paragraph. </p> <Button> Set multiple styles for p </button> </Body> </Html> |
I hope this article will help you with jQuery programming.