[JavaScript] jQuery通过CSS()方法给指定的元素同时设置多个样式 →→→→→进入此内容的聊天室

来自 , 2019-02-20, 写在 JavaScript, 查看 153 次.
URL http://www.code666.cn/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

回复 "jQuery通过CSS()方法给指定的元素同时设置多个样式"

这儿你可以回复上面这条便签

captcha