$("table tr").each(function( index ){ $(this).click(function(){ alert('I am TR number ' + index); }); });
the index() function works on a collection of elements, so you'd have to get them first: $('table tr').click(function(){ alert( $(this).parent().children().index(this) ); }); On Feb 9, 5:48 pm, Pedram <pedram...@gmail.com> wrote: > How COme we could not have access inside the BIND with THIS !! I'm > Confused > > On Feb 9, 7:16 am, Pedram <pedram...@gmail.com> wrote: > > > I check these two solutions it didn't work ... > > > On Feb 8, 11:42 pm, RobG <rg...@iinet.net.au> wrote: > > > > On Feb 9, 4:54 pm, Pedram <pedram...@gmail.com> wrote: > > > > > Dear folk, > > > > I want to get the index of the TR and send it to the Function , I > > > > don't know how to it . this is what I'm trying to do > > > > > $("table tr").bind("click",{IndexName:$(this).index(this)},clickFunc) > > > > The DOM 2 HTML TR.rowIndex property should do the job. > > > > -- > > > Rob