各ブロックの最初の P にクラス「無視」を追加し、最後の P にクラス「スタイル」を追加しようとしています。
<div class="tiles_large">
<span class="spacer"> </span>
<p>image here</p>
<span class="spacer"> </span>
<h4>headline here</h4>
<span class="spacer"> </span>
<p>content here</p>
<span class="spacer"> </span>
</div>
<div class="tiles_small">
<span class="spacer"> </span>
<p>image here</p>
<span class="spacer"> </span>
<h4><div><span>headline here</span></div></h4>
<span class="spacer"> </span>
<p>content here</p>
<span class="spacer"> </span>
</div>
これは私の jquery ですが、期待どおりの結果が返されません。
$(".tiles_large p,.tiles_small p").each(function() {
$(this).find("p:first").addClass("ignore");
});
$(".tiles_large p,.tiles_small p").each(function() {
$(this).find("p:last").addClass("style");
});