[jQuery] Re: how to streamline my code with Event Delegation?

2009-04-21 Thread redsun
many thanks guys. i've learnt a lot from your replies and found uses for the scripts well beyond my initial query.

[jQuery] Re: how to streamline my code with Event Delegation?

2009-04-16 Thread Andy Matthews
It would be more ideal to have some better way to identify each link. For example, assuming a similar structure: div id=linkContainer a href=link 01/a a href=link 02/a /div You might have this code: // all anchor tags inside the linkContainer $('#linkContainer

[jQuery] Re: how to streamline my code with Event Delegation?

2009-04-16 Thread mkmanning
You could put event delegation on the containing element, and then use the target's index within its parent. From Andy's example this would be: div id=linkContainer a href=link 01/a a href=link 02/a /div $('linkContainer').click(function(e){ var targ = $(e.target), index =

[jQuery] Re: how to streamline my code with Event Delegation?

2009-04-16 Thread dhtml
On Apr 16, 12:28 pm, redsun sun...@yahoo.com wrote: i'm sure the jQuery i'm using below is very ineffiecient. the only I would not doubt that it is inefficient (you are using jQuery). syntax that changes are the numbers in the names of my IDs and my variables - and even they're matching.