Hello everyone,
I've tried searching for this but couldn't find anything that matched
this.
I would like to invoke() the insert() method on an element and insert
a link at the end of every fieldset on my page.
This is my code:
$$('form.form fieldset').invoke('insert',
new Element('a',{ href: '#' })
.update('advanced')
.observe('click', function(event) {
this.up('form.form').toggleClassName('simple');
})
);
What happends is that the link is only inserted at the last fieldset
of my page.
Also when I create the link first like:
var link = new Element(...);
and then:
$$('form.form fieldset').invoke('insert',link);
The same thing happends, only the last fieldset gets a link.
Am i really forced to use each() like this?
$$('form.form fieldset').each(function(fieldset) {
fieldset.insert(new Element(...).update(...).observe(...);
}
I really hope you can tell me what I am doing wrong because I really
want to make the code as good as possible.
Thanks in advance,
Johan
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---