有CSS代码 定义了一些一个叫data-classbreak的属性,取不同属性值时的style效果:
path[data-classbreak="classbreak0"] {
stroke: rgb(255, 245, 220);
stroke-width: 1pt;
stroke-opacity: 0.35;
fill: #00008B;
fill-opacity: 0.8;
}
path[data-classbreak="classbreak1"] {
stroke: rgb(255 ,140 ,0);
stroke-width: 1pt;
stroke-opacity: 0.35;
fill: #1E90FF;
fill-opacity: 0.8;
}
path[data-classbreak="classbreak2"] {
stroke: rgb(255, 245, 220);
stroke-width: 1pt;
stroke-opacity: 0.35;
fill: #00008B;
fill-opacity: 0.8;
}
源代码中有一句, node.setAttribute("data-classbreak", “classbreak0”);
即为一个节点的data-classbreak赋予classbreak0对应的style。
现在我需要用jquey动态地修改例如path[data-classbreak="classbreak0"]中的fill属性,尝试 $("path[data-classbreak='classbreak0]").css("fill","#33FF00")并没有效果,请问应该怎么改?谢谢!