js中的style与jQuery中的css

使用jQuery选择器时,可以直接使用css函数(注意不能使用$("p")[1].css())

$("p").css("background-color","green");

 当应用于其中一个元素时使用(style.cssText 可以同时支持多个样式)

			$("p").get(0).style.cssText = "background-color:green;color:red";
			$("p")[0].style.cssText = "background-color:green;color:red";
			$("p").get(2).style.backgroundColor = "orange";

 

posted @ 2016-07-16 15:35  WhyToHow  阅读(401)  评论(0编辑  收藏  举报