[jQuery] Re: Loop thru options of a Select box

2007-10-26 Thread Adrian Lynch
$(function() { $("#state option").each(function(i){ alert($(this).text() + " : " + $(this).val()); }); }); Will do it. Try here for a nice API reference: http://www.visualjquery.com/ It'll answer a ton of your questions. Adrian On Oct 26, 6:41 pm, "[EMAIL PROT

[jQuery] Re: Loop thru options of a Select box

2007-10-26 Thread Glen Lipka
The code Wizzud gave is pretty good. To get a value and label just use the attr function. jQuery('#state option').each(function(i){ alert($(this).attr("value")); alert($(this).attr("label")); }); Glen On 10/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Hi, > > Thanks, can yo

[jQuery] Re: Loop thru options of a Select box

2007-10-26 Thread [EMAIL PROTECTED]
Hi, Thanks, can you show sample code of accessing every element's value and label? On Oct 27, 1:30 am, Wizzud <[EMAIL PROTECTED]> wrote: > jQuery('#state option').each(function(i){ > > }); > > On Oct 26, 5:49 pm, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > Hi, > > > given th

[jQuery] Re: Loop thru options of a Select box

2007-10-26 Thread Wizzud
jQuery('#state option').each(function(i){ }); On Oct 26, 5:49 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > given this, how to iterate thru the options? thanks > > > New York > Alaska > Kentuky > IOWA >