首页 > Web开发 > 详细

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

时间:2015-07-20 16:04:14      阅读:244      评论:0      收藏:0      [点我收藏+]

<!DOCTYPE html>

<html>
<head>
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").css({"background-color":"yellow","font-size":"200%"});
  });
});
</script>
</head>
 
<body>
<h2>This is a heading</h2>
<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>

 

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

原文:http://www.cnblogs.com/mm2015/p/4661426.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!