thanks ROb , I Appreciate it , I'm writing a Plugin I am going to use the last part of your code , that I'm fine with that. great. THanks other guys , my Problem Is solved
On Feb 9, 3:44 pm, RobG <rg...@iinet.net.au> wrote: > On Feb 10, 5:48 am, Pedram <pedram...@gmail.com> wrote: > > > How COme we could not have access inside the BIND with THIS !! I'm > > Confused > > I don't know why you want to make it so complex. Consider: > > $("table tr").click(function(){alert(this.rowIndex);}); > > If you want to call a function: > > $("table tr").click(function(){clickFunc(this.rowIndex)}); > > If you want to use bind (and I don't see the point, but anyhow...) > > $("table tr").bind("click", function() { > clickFunc(this.rowIndex); > }); > > function clickFunc(rowIndex) { > alert(rowIndex); > } > > or, to get closer to your original: > > $("table tr").bind("click", {prop1:'property 1', prop2: 'property > 2'}, clickFunc); > > and in clickFunc: > > function clickFunc(e) { > alert(this.rowIndex); > } > > Going further: > > $("table tr").bind("click", {prop1:'property 1', prop2: 'property > 2'}, clickFunc); > > function clickFunc(e) { > alert(this.rowIndex + '\n' + e.data.prop1); > } > > See? No selector needed, the row has a rowIndex property that tells > you which row it is in the table. If you have a thead element, its > rows are counted in the rowIndex and rows in tfoot include all the > rows above (i.e. it is the index in the entire table). > > -- > Rob