$("#fruits option:selected").get(0).index
On 28 Sep., 08:33, GARIL <[EMAIL PROTECTED]> wrote: > Thank you. What's the code if I want the index of the selected item? > > On Sep 28, 12:53 am, Alex Weber <[EMAIL PROTECTED]> wrote: > > > $('#fruits').val() > > > On Sep 28, 2:12 am, GARIL <[EMAIL PROTECTED]> wrote: > > > > How do I use jQuery to determine which item was selected from the > > > forms below? > > > Thank you for the help. > > > > <form> > > > Select your favorite fruit: > > > <select id="fruits"> > > > <option>Apple</option> > > > <option>Orange</option> > > > <option>Pineapple</option> > > > <option>Banana</option> > > > </select> > > > </form> > > > > <form> > > > Select your favorite fruit: > > > <select id="analysis"> > > > <option>All fruits</option> > > > <option>Some only...</option> > > > </select> > > > </form> > >