Yeah add the event to the element when it's created.
var item = new Element('li',{
'events':{
'click':function(){
return this.get('rel');
}
}
});
On Nov 22, 9:35 am, אריה גלזר <[email protected]> wrote:
> i am not sure why ou would need a specific number. can't you assign an event
> on item creation:
> var item = new Element('li',{
> 'events':{
> 'click':function(){/*do something*/}}
> });
>
> -----------
> אריה גלזר
> 052-5348-561
> 5561
>
> On Sun, Nov 22, 2009 at 08:09, Jake <[email protected]> wrote:
> > I've hit a wall in my quest to figure out how to acquire attribute
> > data from an unordered list.
>
> > Here's what I'm doing:
>
> > I have a script that dynamically creates an unordered list as a
> > navigation menu.
>
> > The only way I can think of to get click information from this list is
> > if there is a specific set number of list items, and have click events
> > for each one.
>
> > Say a list of 10 items would mean 10 separate click event handlers.
>
> > 20 list items would mean 20 event handlers.
>
> > This doesn't seem very elegant to me. But I'm a MooTools noob, so
> > perhaps there is a better way?