You can add this transformation in the onSuccess callback of your Ajax call:
new Ajax.Updater('foo', '/get/more/foo', {onSuccess: function(){ $$('.foo').invoke('addClassName', 'bar'); }); As long as you don't have a ton of DOM changes happening, this should just work. Otherwise, you may want to wrap it in a Defer to ensure that the DOM is stable before you run it. Walter On Oct 24, 2012, at 8:00 AM, Henrik Aagaard Sørensen wrote: > No, unfortunately it's not that. > > It's elements being loaded into the dom later. I'm already using dom:loaded > and I've placed the JS jus before </body> as the last element. > However, there are several Ajax-calls which later (in the future, after > everything is loaded) creates new elements (which I have no control over), so > I need to have Prototype adding specific class-names in elements which > fullfill CSS selector at all time. > > On Wed, Oct 24, 2012 at 1:57 PM, Walter Lee Davis <wa...@wdstudio.com> wrote: > Can you describe what you mean by future elements on the page? Do you mean > elements that are later in the source order than the script? If so, that's > pretty simple: > > document.observe('dom:loaded', function(){ > $$('div.foo').invoke('addClassName', 'bar'); > }); > > Walter > > On Oct 24, 2012, at 7:52 AM, Henrik Aagaard Sørensen wrote: > > > I'm trying to append a class via addClassName on future elements on a page > > with Prototype, however I do seem to struggle a bit with it. I know of > > jQuery's .live feature, but I cannot find a similar feature in Prototype. > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Prototype & script.aculo.us" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/prototype-scriptaculous/-/3R9rCrWTjaIJ. > > To post to this group, send email to > > prototype-scriptaculous@googlegroups.com. > > To unsubscribe from this group, send email to > > prototype-scriptaculous+unsubscr...@googlegroups.com. > > For more options, visit this group at > > http://groups.google.com/group/prototype-scriptaculous?hl=en. > > -- > 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 prototype-scriptaculous@googlegroups.com. > To unsubscribe from this group, send email to > prototype-scriptaculous+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/prototype-scriptaculous?hl=en. > > > > -- > 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 prototype-scriptaculous@googlegroups.com. > To unsubscribe from this group, send email to > prototype-scriptaculous+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/prototype-scriptaculous?hl=en. -- 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 prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.