Cool. But change the variable name! It's not an array, it's an object. Two
very different things in JavaScript.

Calling it an array will just lead to confusion. :-)

-Mike

On Wed, Sep 30, 2009 at 7:02 AM, Poloman <[email protected]> wrote:

>
> owesome just what i need to learn. Thank you very much
>
> On Sep 30, 8:05 pm, Karl Swedberg <[email protected]> wrote:
> > On Sep 30, 2009, at 1:00 AM, Poloman wrote:
> >
> >
> >
> > > Can I get value and text of an option and put them into an array
> > > object?
> >
> > >    <select>
> > >        <option value="c1">britney</option>
> > >        <option value="c2">jackson</option>
> > >    </select>
> >
> > > I'd like to have something like this  arrayob = {c1:"britner",
> > > c2:"jackson"};
> >
> > You could do something like this ...
> >
> > var arrayob = {};
> > $('option').each(function() {
> >    arrayob[this.value] = $(this).text();
> >
> > });
> >
> > --Karl
> >
> > ____________
> > Karl Swedberg
> >
> > www.englishrules.com
> >
> > www.learningjquery.com
>

Reply via email to