Hi Stijn,

The $() utility function returns a single element, not an enumerable
array.  $$('dynamic') returns elements with tag name 'dynamic'.  I'm
guessing there won't be any.  $$('#dynamic') would return an array of
your element.  But, unless you have a good reason for needing an
array, $() is more appropriate.

Try:
$('dynamic').addClassName('border');
instead.

You should check out the API docs for instructions on how to use css
selectors:
http://www.prototypejs.org/api/utility/dollar-dollar

Regards,
Knox

On Mar 7, 9:42 am, Tarscher <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a dynamic list of divs I want to add a class to:
> $('dynamic').invoke('addClassName', 'border')
>
> The list can also only contain 1 div resulting in a unknown function
> addClassName . Is this caused by the fact that there is only 1 div? Is
> there a way around this?
>
> thanks
> Stijn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to