我想从这个对象中取出物品:
var things = {
"thing1" : "I'm one",
"thing2" : "I'm two",
"thing3" : "I'm three",
}
并将它们附加到此标记中:
<div class="allthings">
<div class="thing1">other content first. </div>
<div class="thing2">other content first. </div>
<div class="thing3">other content first. </div>
</div>
导致:
<div class="thing1">other content first. <p class="added">I'm one</p></div>
... etc.
我不擅长 .each() 循环。什么是 jQuery 等价物:
“对于对象中的每个项目,找到与项目的键匹配的类的 div,并将项目的值附加为带有“已添加”类的段落。”