Or better yet:

$('option:selected')...

Also, I think I'd get rid of this:

var n = this.name || this.id;

because the id should not be used for the name.  I think that's always
been wrong and it would result in a different behavior when javascript
is disabled.

Mike

On 10/3/06, Webunity | Gilles van den Hoven <[EMAIL PROTECTED]> wrote:
> Mat,
>
> This code:
>
> >     if (t == 'select-multiple') {
> >         $('option', this).each( function() {
> >             if (this.selected)
> >                 a.push({name: n, value: this.value ||
> > $(this).text()});
> >         });
> >         return;
> >     }
>
> Can be changed to this, if i am right ;)
>
> >     if (t == 'select-multiple') {
> >         $('[EMAIL PROTECTED]"selected"]', this).each( function() {
> >             a.push({name: n, value: this.value || $(this).text()});
> >         });
> >         return;
> >     }
>
> Other then that,
>
> Great code!
>
> -- Gilles
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to