var myRows = $('table#id tr').click(function(){ alert('Row #' + myRows.index(this) + ' clicked'); });
(index is 0-based, ie clicking on the 7th row returns 'Row #6 clicked' in the example above.) On Oct 10, 3:28 pm, RichUncleSkeleton <[EMAIL PROTECTED]> wrote: > Is it possible to detect the 'child number' of an element on click? > > For example, say I have a table with 10 rows. If I click on the 7th > row, is it possible to obtain the number 7 simply? Currently I have a > click event attached to every table row, with something along the > lines of: > > $('table#id tr').click(function(){ > ... > > })