Hi,

Watch out for class... it's a reserved keyword in JS. Prototype
supports either using className (preferred imho) or 'class':

new Element('a', { 'class': 'my-class' })
new Element('a', { className: 'my-class' })

Best,

Tobie

On Jan 23, 10:49 pm, "Justin Perkins" <[EMAIL PROTECTED]> wrote:
> On Jan 23, 2008 3:42 PM, elduderino <[EMAIL PROTECTED]> wrote:
>
> > ....how do i add an id to an element i've just created....i've just
> > done:
>
> You'll want to use the Element constructor for 
> that:http://prototypejs.org/api/element
>
> new Element('a', { id: 'my-id', class: 'my-class', href:
> 'http://www.prototypejs.org/api/element'}).update('Click me to see
> the API for the Element object');
>
> Much handier than the old way of doing things with document.createElement().
>
> -justin
--~--~---------~--~----~------------~-------~--~----~
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