[jQuery] Re: getting element number?

2008-02-06 Thread Scott González
I realize you found a solution, but you might want to look at this plugin (I'll eventually get around to adding it to the jQuery plugin repository): http://scottsplayground.com/temp/jquery.ordinal.js Also, something a lot of people aren't aware of is: $(this).parent().children().index(this);

[jQuery] Re: getting element number?

2008-02-05 Thread Giant Jam Sandwich
$('#' + self.options.auto_complete_id + ' li').bind( 'mouseover', function() { $this = this; $(this).parent().children().each( function( i ) { if ( $this == this ) { alert( i + 1 ); } }); }); On Feb 5, 8:15 am,

[jQuery] Re: getting element number?

2008-02-05 Thread besh
Hi Eridius, I guess this could do it: $('#' + self.options.auto_complete_id + ' li').each(function(i) { // i is now an index $(this).bind('mouseover', function() { //do something on mouseover }); }); -- Bohdan Ganicky On Feb 5, 2:15 pm, Eridius [EMAIL PROTECTED] wrote:

[jQuery] Re: getting element number?

2008-02-05 Thread David Serduke
untested but something like this should work using closure: $('#' + self.options.auto_complete_id + ' li').each(function (i) { $(this).bind('mouseover', function() { if (i == 3) { //code } }); }); David

[jQuery] Re: getting element number?

2008-02-05 Thread Eridius
Yea, i just thought about the .each thing about 15mins ago and it worked perfect. Thanks for the replies. Bohdan Ganicky wrote: Hi Eridius, I guess this could do it: $('#' + self.options.auto_complete_id + ' li').each(function(i) { // i is now an index