【发布时间】:2014-11-04 08:21:22
【问题描述】:
Jquery noob,所以请不要太用力。 在产品描述中获得带有表格的产品网格。表 td 具有相同的类,当我尝试从它们中提取内容并插入到不同的位置时,我仍然得到相同的内容,每个产品的内容都不同。
这里是html
<div class="product">
<div class="product777">
<table>
<tr><td class="varimage1">content 1</td><td class="varimage2">COntent2</td></tr>
</table>
<div class="galitem1"></div>
<div class="galitem2"></div>
</div></div>
这是一段js代码
$(".product").each(function(){
// tried this
var colorimgab = $(".varimage2").html();
//and tried this
var colorimgaa = $(this).closest(".product777").find(".varimage1").html();
$(".galitem1").html(colorimgaa);
$(".galitem2").html(colorimgab);
});
【问题讨论】:
-
.product和.product777是什么? -
已编辑。搞砸了简化代码
标签: javascript jquery html