这是类名为“assistance_wrap”的样本格。更改ID中的班级
<div class="assistance_wrap">
<div class="top"></div>
<div class="header highlight">Types of assistance offered at this event:</div>
<div class="nearby_header highlight">This event is currently full, but there are other ways you can</div>
</div>
我已经克隆了这个div,每个克隆版本都附有一个唯一的ID。
<div id="assistance_wrap_315" class="assistance_wrap">
<div class="top"></div>
<div class="header highlight">Types of assistance offered at this event:</div>
<div class="nearby_header highlight">This event is currently full, but there are other ways you can</div>
<div id="assistance_wrap_316" class="assistance_wrap">
<div class="top"></div>
<div class="header highlight">Types of assistance offered at this event:</div>
<div class="nearby_header highlight">This event is currently full, but there are other ways you can</div>
在我的JS我给你的名字new_info与类样品div的副本“assistance_wrap” 并分配唯一的ID,并显示我的网页上。 现在我想改变类里面的文字near_header亮点谁的父母div id是 assistance_wrap_316我应该怎么做?
这是我试过的。日志的输出基本上是div的整个文本,编号为assistance_wrap_316。
console.log(new_info.find('#assistance_wrap_'+ event_data.eventId , '.nearby_header highlight').text());
假设event_data.eventId的价值为316
如果'new_info'是副本带有'assistance_wrap'类的div然后做'new_info.find('#assistance_wrap _...'试图fin d内部的div – MrOBrian 2012-07-17 22:47:12