JQuery obtains the specified style of elements through CSS () method

From , 2 Years ago, written in JavaScript, viewed 158 times.
URL https://pastebin.vip/view/45d6637b
  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.     alert("Background color = " + $("p").css("background-color"));
  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. <button>Return background-color of p</button>
  21. </body>
  22. </html>
  23.  
  24. //javascript/8119

Reply to "JQuery obtains the specified style of elements through CSS () method"

Here you can reply to the paste above

captcha

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