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