2
我需要使用jQuery在集合的每个元素上添加CSS属性。有什么建议么?将css属性添加到来自对象的集合
var jsonCss = {
"color": "#555555",
"font-weight": "bold",
"text-align": "left"
};
var $tdCollection = $("tr:first-child").find("td:nth-child(2)"); //A collection of <td> elements
$.each($tdCollection, function(k, v){
v.css(jsonCss);
})
使用类和类添加到您想给CSS – guradio
谢谢你帮助的元素。我必须使用JSON对象。 – zm455