The reason you need to use an index on playlist is because select returns an
array, so... instead of using the index[0] the way you've done, you can send
it back to the el.select():
$$('div.fp_YouTube').each(function(el) {
var player = el.select('.player')[0]; // <--- right here!
var playlist = el.select('.playlist li'); // also... select your li's
here, this will save you another select() call on the next line!
playlist.each(function(video) { // <-- neater.
console.log(video.id);
});
});
Have a look:
http://jsbin.com/avedu
Rick
On Wed, Jul 1, 2009 at 1:37 PM, Ian R <[email protected]> wrote:
>
>
> I did check on the array situation -- it's so good and bad that
> finally turning to this forum and *writing it all down* usually solves
> the problem!
>
> In the above case, $(playlist).select('li').each didn't work, but
> playlist[0].select('li').each does.
>
> I'm not sure that I exactly LOVE how that works, but it's not
> terrible. If there's a better way, I'd love to know about it.
>
> Thanks!
> Ian
> >
>
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---