3つおきの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>
)があり、3回の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>');
}
しかし、期待どおりの結果が得られない場合
は、次のリンクを参照してください。
解決策を手伝ってください。どうもありがとう。