++
On Monday, May 7, 2012 9:04:02 PM UTC+2, Sanford Whiteman wrote: > > > The problem is, that I am not able to select this content anywhere. > > Of course I am not able to add a event at the beginning because the AJAX > > request was not send then and the class/id won't exist at this time. > > Delegate the click on the outer container (which does exist), which > will catch the clicks for later dynamically added content. This is > pretty much the perfect case for delegation. > > You could also dip into the more advanced technology that Rolf > suggests, but I think getting a handle on basic delegation is a first > step no matter what. > > > I am but also not able to get the elements in the onSuccess method > > of the Request.HTML class and add a click event to them. > > Don't worry about adding click events to the individual elements > unless there is something that makes them non-generalizable (so that > each event would have to be tuned to element data that seems like it > can't be gathered at runtime). > > Usually, even if there *is* something that makes every element very > different (beyond just id that might be used to locate a database > row), then you can pass the special event data back as a data- > attribute on the element and have the click event read out that data > at event-runtime to "customize" the event further. > > -- S. > >