[jQuery] Re: How to get option's position

2009-06-09 Thread huytoan.pc
$('option').click(function(){ var index = $('option').index(this) + 1; //index() will return zero based result so plus 1 here }); On Jun 9, 8:23 am, "David .Wu" wrote: > if I have a menu, how to get the position of the option after I select > one of it? > > for example, if I choose

[jQuery] Re: How to get option's position

2009-06-08 Thread RobG
On Jun 9, 11:23 am, "David .Wu" wrote: > if I have a menu, how to get the position of the option after I select > one of it? > > for example, if I choose b, and the position should b 2. > > a > b > c > Select elements have a (zero indexed) selectedIndex property that tells you which option i