On Jul 1, 6:16 pm, Ian R wrote:
>
> $$('div.fp_YouTube').each(function(el) {
> var player = el.select('.player');
> var playlist = el.select('.playlist');
> playlist.select('li').each(function(video) {
> console.log(video.id);
> });
>
> });
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!
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 wor
Is it returning an array ?
Check with
$$('div.fp_YouTube').each(function(el) {
var player = el.select('.player');
var playlist = el.select('.playlist');
alert(playlist); // see if its an object
return;
playlist.select('li').each(function(video) {
console.log(video.id);
});
});
if it is returnin
This sent off by accident before I was done. I've resubmitted a
complete post here:
http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/fe0e1581be6b861f?hl=en
Forgive me but I cannot seem to delete this one, though the
instructions seem pretty straightforward (click the