我正在寻找在每三个 div 标签之后放置一个跨度标签的解决方案。
HTML
<div class="grid_15">
<div class="grid_5">
<p>Sun</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
<div class="grid_5">
<p>Mon</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
<div class="grid_5">
<p>Tue</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
<div class="grid_5">
<p>Wed</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
<div class="grid_5">
<p>Thu</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
<div class="grid_5">
<p>Fri</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
<div class="grid_5">
<p>Sat</p>
<div>
<div class="suggest nudge-up">
<div class="form-content-left">Morning</div>
<div class="form-content-right">(7.00 - 8.00)</div>
<span class="clear"></span><span class="clear"></span>
</div>
</div>
</div>
</div>
需要
<div class="grid_15">
<div class="grid_5">
<p>Sun</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
<div class="grid_5">
<p>Mon</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
<div class="grid_5">
<p>Tue</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
**<span class="clear"></span>**
<div class="grid_5">
<p>Wed</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
<div class="grid_5">
<p>Thu</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
<div class="grid_5">
<p>Fri</p>
<div>
<div class="suggest nudge-up"><span class="form-content-left">All Hours</span><span class="clear"></span></div>
</div>
</div>
**<span class="clear"></span>**
<div class="grid_5">
<p>Sat</p>
<div>
<div class="suggest nudge-up">
<div class="form-content-left">Morning</div>
<div class="form-content-right">(7.00 - 8.00)</div>
<span class="clear"></span><span class="clear"></span>
</div>
</div>
</div>
</div>
如您所见,结果有,跨度标记(<span class="clear"></span>
),每三个 div 完成后,我尝试:
jQuery
var a = $('html').find('div.grid_15 > div.grid_5');
for( var i = 0; i < a.length; i+=3 ) {
a.slice(i, i+3).append('<span class="clear"></span>');
}
但没有得到预期的结果,
这里是链接:
请帮我解决。非常感谢。