[jQuery] Re: Passing a Index to a function

2009-02-10 Thread tres
var li = $('ul li'); li.bind('click', function() { alert(li.index(this)); }); ...works for me. Also, if you are calling jQuery on the same set of objects more than once, it is wise to set a reference to it instead of re calling it more than once. Instead something such as this: $('ul li

[jQuery] Re: Passing a Index to a function

2009-02-09 Thread Pedram
I came back to my COde An I found your code fit in mine I am not going to use rowIndex because My Plugin it should work for every selector so what I atually want to do to get the selector name and bind an event to it and sent it to a function and also pass the index to the function and the reason

[jQuery] Re: Passing a Index to a function

2009-02-09 Thread Pedram
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 wrote: > On Feb 10, 5:48 am, Pedram wrote: > > > How COme we could not have access inside the BIND

[jQuery] Re: Passing a Index to a function

2009-02-09 Thread RobG
On Feb 10, 5:48 am, Pedram 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(funct

[jQuery] Re: Passing a Index to a function

2009-02-09 Thread Ricardo Tomasi
$("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

[jQuery] Re: Passing a Index to a function

2009-02-09 Thread Pedram
How COme we could not have access inside the BIND with THIS !! I'm Confused On Feb 9, 7:16 am, Pedram wrote: > I check these two solutions it didn't work ... > > On Feb 8, 11:42 pm, RobG wrote: > > > On Feb 9, 4:54 pm, Pedram wrote: > > > > Dear folk, > > > I want to get the index of the TR an

[jQuery] Re: Passing a Index to a function

2009-02-09 Thread Pedram
I check these two solutions it didn't work ... On Feb 8, 11:42 pm, RobG wrote: > On Feb 9, 4:54 pm, Pedram 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",{Ind

[jQuery] Re: Passing a Index to a function

2009-02-08 Thread RobG
On Feb 9, 4:54 pm, Pedram 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 j

[jQuery] Re: Passing a Index to a function

2009-02-08 Thread Geuis
$("table tr").click(function() { clickFunc($('table tr').index(this); }); On Feb 8, 10:54 pm, Pedram 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: