The "option:selected" is the only syntax that has worked for me in the
past. The XPath method only gets those options that literally have an
attribute of "selected" in the XHTML.
I also agree with you on the matter of excluding this.id as a fallback
for n. It's unnecessary and possibly confusing behavior.
m.
On Tue, 2006-10-03 at 09:14 -0400, Mike Alsup wrote:
> 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
> > [email protected]
> > http://jquery.com/discuss/
> >
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/