my bad. I was changing it around. It shoudl be

$("div[id ^= 'childtest_' ] :first-child").each(function() {
                                        alert( $(this).attr("id") )

});

On Apr 29, 3:55 pm, MorningZ <morni...@gmail.com> wrote:
> I don't understand.. there's no where that you are using ":first-
> child" like your subject line says
>
> On Apr 29, 11:43 am, Liming <lmxudot...@gmail.com> wrote:
>
> > Hello all, I have a lay out like so
>
> > <div id="childtest_toprow">
> >                 <div id="subtest_1">
> >                         <div id="subtest_1_1"></div>
> >                         <div id="subtest_1_2"></div>
> >                 </div>
> >                 </div>
> >                 <div id="subtest_2">
> >                 </div>
> > </div>
>
> > I want to select the first child of "childtest_toprow" which is
> > "subtest_1"
>
> > when i do
>
> > $("div[id ^= 'childtest_' ] :nth-child(1)").each(function() {
> >                                         alert( $(this).attr("id") )
>
> > });
>
> > I get "subtest_1" AND "subest_1_1"
>
> > what am I doing wrong?
>
> > Thanks
>
> > ps: i'm using firefox 3 and IE 7

Reply via email to