世界でこれが機能しない理由を誰が知っていますか:
$( "p p" ).each(function() {
$(this).css("color", "green");
});
「p > p」、またはネストされた段落要素を持つものと同様に。divやその他の要素で問題ありませんが
たとえば、これを確認してください:
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
alert('length='+$('p p').length); // 0
</script>
<div style="border:1px solid;">
<p>The first paragraph in div.</p>
<p>The second paragraph in div (and the 2nd child in this div).</p>
<p>
<span>Span within p (WILL BE fount as "p > span")</span>
<p>P within p (1).</p>
<span>Span within p (will NOT be fount as "p > span")</span>
<p>P within p (2).</p>
</p>
</div>
<p>
<span>Span within p (WILL BE fount as "p > span")</span>
<p>P within p (1).</p>
<span>Span within p (will NOT be fount as "p > span")</span>