Check out the "Event Delegation" section of this excellent article

http://www.learningjquery.com/2008/03/working-with-events-part-1



On Oct 31, 12:07 pm, "c.barr" <[EMAIL PROTECTED]> wrote:
> I'm working on a project where we have a table and each row is
> clickable (but only certain columns within that row), but we cannot
> use an <a> tag for other reasons.  Currently I have to attach click
> events to the proper table cells, which works just fine, it's just
> inefficient.
>
> If I have a table with 50 rows, and 3 cells in each row need click
> events, that's 150 events attached! We're also doing ajax pagination,
> so each time we page over that's another 150 events to attach.
>
> So my question is, can I attach a single click event to the entire
> table, and then determine which element was clicked within that?

Reply via email to