That still wont work...

 console.log( $$('#gridRow').last().down().innerHTML );

# <--- is for IDs

you need:

 console.log( $$('.gridRow').last().down().innerHTML );


And i PROMISE that wont work either, you need to iterate through
$$('.gridRow') if you want to output both rows.

Like so:


   <div class="gridRow">
     <span>hi</span>
   </div>
   <div class="gridRow">
     <span>bye</span>
   </div>
   <script>
     document.observe('dom:loaded',function(){
      $$('.gridRow').each( function (g) {
        console.log(g.down().innerHTML);
      });
     });
   </script>


dig it.






On Thu, Jun 4, 2009 at 5:53 PM, Douglas <douglas.gont...@gmail.com> wrote:

>
> Hello, you cannot set the same ID more than once; You problably wanted
> to use classes instead of it;
>
> [example]
>    <div class="gridRow">
>      <span>hi</span>
>    </div>
>    <div class="gridRow">
>       <span>bye</span>
>    </div>
>    <script>
>      document.observe('dom:loaded',function(){
>        console.log( $$('#gridRow').last().down().innerHTML );
>      });
>    </script>
> [/example]
>
> I think firefox always evaluate the very last ID found in whole
> document. I dont use IE though.
> Cheers
>
>
> On Thu, Jun 4, 2009 at 1:26 PM, Christian P <zar...@gmail.com> wrote:
> >
> > I am using the latest prototype.js from git
> >
> > HTML
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> > <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> >  <head>
> >    <title>My Prototype test bench</title>
> >    <script type="text/javascript" src="lib/prototype.js"></script>
> >    </head><body>
> >
> >    <h1>A simple page to test Prototype</h1>
> >    <div id="gridRow">
> >      <span>hi</span>
> >    </div>
> >    <div id="gridRow">
> >      <span>bye</span>
> >    </div>
> >    <script>
> >      document.observe('dom:loaded',function(){
> >        console.log( $$('#gridRow').last().down().innerHTML );
> >      });
> >    </script>
> >  </body>
> > </html>
> >
> >
> > IE logs "hi"
> > Firefox logs "bye"
> >
> > Why is that?
> >
> > >
> >
>
>
>
> --
> Believe nothing, no matter where you read it, or who said it, no
> matter if I have said it, unless it agrees with your own reason and
> your own common sense.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to