[jQuery] Re: Event delegation and accounting for children/descendants

2008-09-17 Thread Matt Kruse
On Sep 15, 1:06 am, hubbs [EMAIL PROTECTED] wrote: I was reading a great post on learningjquery.com about event delegation, and it gave an example of how to account for child/ descendants that might get clicked. See also my recent post to this thread:

[jQuery] Re: Event delegation and accounting for children/descendants

2008-09-17 Thread Karl Swedberg
Hi hubbs, 1. If you want to throw an alert, you could do it like this: $(document).ready(function() { $('table').click(function(event) { var $thisCell, $tgt = $(event.target); if ($tgt.is('td')) { $thisCell = $tgt; } else if ($tgt.parents('td').length) { $thisCell =