JQuery sets multiple styles for the specified element at the same time through CSS () method

From , 5 Years ago, written in JavaScript, viewed 88 times.
URL https://pastebin.vip/view/71b9e42f
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
  5. </script>
  6. <script>
  7. $(document).ready(function(){
  8.   $("button").click(function(){
  9.     $("p").css({"background-color":"yellow","font-size":"200%"});
  10.   });
  11. });
  12. </script>
  13. </head>
  14.  
  15. <body>
  16. <h2>This is a heading</h2>
  17. <p style="background-color:#ff0000">This is a paragraph.</p>
  18. <p style="background-color:#00ff00">This is a paragraph.</p>
  19. <p style="background-color:#0000ff">This is a paragraph.</p>
  20. <p>This is a paragraph.</p>
  21. <button>Set multiple styles for p</button>
  22. </body>
  23. </html>
  24.  
  25. //javascript/8121

Reply to "JQuery sets multiple styles for the specified element at the same time through CSS () method"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website