In going through the 'Learning jQuery' book, I did some experimenting
with the content of 'Chapter 1/alice.html'. Specifically, I have this
selector and statement...

$(document).ready(function() {
$('.poem-stanza > div:eq(1)').addClass('blue_txt');
});

The problem is that when this is applied only the FIRST INSTANCE of
"second child div of class .poem-stanza" gets the new class. Please
note that the alice.html file has TWO INSTANCES of '.poem-stanza >
div:eq(1)'.

YKCOWREBBAJ

sevot yhtils eht dna ,gillirb sawT'
;ebaw eht ni elbmig dna eryg diD           <!-- THIS ONE -->
,sevogorob eht erew ysmim llA
.ebargtuo shtar emom eht dnA

She puzzled over this for some time, but at last a bright thought
struck her. "Why, it's a Looking-glass book, of course! And if I hold
it up to a glass, the words will all go the right way again."
This was the poem that Alice read.

JABBERWOCKY

'Twas brillig, and the slithy toves
Did gyre and gimble in the wabe;            <!-- THIS ONE -->
All mimsy were the borogoves,
And the mome raths outgrabe.

QUESTION: Why does the 2nd instance get ignored (unprocessed)? How do
I modify my statement so that the 2nd instance DOES get processed?

THANKS!

JoKin

Reply via email to