[jQuery] Re: form select...

2008-10-01 Thread GARIL
I did. Thanks Josh. I modified it in such a way that given an index x I can write: $("#fruits option").get(x).selected = true; And that did it. --- On Oct 1, 3:36 pm, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: > Did you try my code? It should do what you describe. >

[jQuery] Re: form select...

2008-10-01 Thread greenteam003
You could achieve this by using $('#fruits').val('Banana'). All of this is available in the jquery api docs if you take a look. Take a look at http://docs.jquery.com/Attributes http://docs.jquery.com/Attributes for examples of what you're trying to accomplish with the select elements. GAR

[jQuery] Re: form select...

2008-10-01 Thread Josh Nathanson
Give this a go: $("option","#fruits").each(function() { $(this).attr("selected", $(this).text() == 'Pineapple' ); }); -- Josh - Original Message - From: "GARIL" <[EMAIL PROTECTED]> To: "jQuery (English)" Sen

[jQuery] Re: form select...

2008-10-01 Thread Josh Nathanson
Did you try my code? It should do what you describe. -- Josh - Original Message - From: "GARIL" <[EMAIL PROTECTED]> To: "jQuery (English)" Sent: Wednesday, October 01, 2008 1:12 PM Subject: [jQuery] Re: form select... Thank your for your answers b

[jQuery] Re: form select...

2008-10-01 Thread GARIL
Thank your for your answers but I don't want to set the value. What I want to happen is to programmatically change the select into: BEFORE AFTER Select your favorite fruit: Select your favorite fruit:

[jQuery] Re: form select...

2008-10-01 Thread GARIL
Select your favorite fruit: Apple Orange Pineapple Banana In the form above how do I programmatically set using jQuery the Pineapple option as the selected default?

[jQuery] Re: form select...

2008-09-29 Thread GARIL
Beautiful! Thank you very much, Alex and BB. On Sep 28, 7:32 am, BB <[EMAIL PROTECTED]> wrote: > $("#fruits option:selected").get(0).index

[jQuery] Re: form select...

2008-09-28 Thread henson henson
I slowly discovered the jQuery is so great. Hehe I love it! 2008/9/28 BB <[EMAIL PROTECTED]> > > $("#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,

[jQuery] Re: form select...

2008-09-28 Thread BB
$("#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 PROT

[jQuery] Re: form select...

2008-09-27 Thread GARIL
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? >

[jQuery] Re: form select...

2008-09-27 Thread Alex Weber
$('#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. > > > Select your favorite fruit: > >   Apple >   Orange >   Pineapple >   Banana > > > > > Select your favorit