On 06/06/2007, at 1:13 AM, Michael Price wrote:
The following jQuery code should do the trick: $("#book .page").each(function() { $("p:first",this).css("backgroundColor","yellow"); });
Thanks Michael., that should do it. So Sebastián's solution could look like:
$("#book .page").each(function(){ $("p:first",this).each(function(){ /* do stuff with the first paragraph found within each .page div */ }); }); I'm sure this can be reduced even further. Maybe something like: $('#book .page').find('p:first').each(function(){ /* do stuff ... */ }); or even: $('p:first','#book .page').each(function(){ /* do stuff ... */ }); Joel.