On 06/06/2007, at 12:57 AM, Joel Birch wrote:

On 06/06/2007, at 12:48 AM, Sebastián V. Würtz wrote:
Right. but i need all the "first" paragraph of each "page", to execute an "each" function for each one :)

Sorry if I am misunderstanding, but as far as I can tell this should work:

 $('#book div.page p:first').each(function() {
        /*do stuff with each first paragraph found within each .page div*/
});

For example, try this to test if we are getting the elements you require:

$(document).ready(function() {
        $('#book div.page p:first').each(function() {
                this.css({'background-color':'yellow'});
        });
)};

Good luck.

Joel.

Scratch that. For starters I forgot to wrap 'this' in $(). Also, it only seems to get the the first para of the first .page element.

I'll try again.

Reply via email to