Rey,

To my knowledge, the latter is an XPath selector that says "get all
options with an attribute of selected" (like <option
selected="selected">), while the former is a dynamic pseudo-selector
that will get the actual "physically" selected option value at run-time.

m. 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Rey Bango
Sent: Thursday, September 28, 2006 7:26 AM
To: jQuery Discussion.
Subject: Re: [jQuery] Getting Selectbox selected value. Works in IE not
FF.

Matt,

Whats the difference between this:

$('#mySelect :selected').text();

and this:

$('#mySelect [EMAIL PROTECTED]').text();

The latter was code that I grabbed from an earlier posting.

Rey...



Matt Grimm wrote:
> This is all that's needed:
> 
> $('#mySelect').val()
> 
> If you wanted the text value of the selected option rather than it's 
> value attribute, you could do:
> 
> $('#mySelect :selected').text()
> 
> m. 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> On Behalf Of Rey Bango
> Sent: Thursday, September 28, 2006 7:08 AM
> To: jQuery Discussion.
> Subject: [jQuery] Getting Selectbox selected value. Works in IE not
FF.
> 
> Guys,
> 
> I'm tesing some code out to return the selected value of a dropdown. I

> found a snippet that was posted in a prior message but it seems to 
> only work in IE and not in FF. FF returns null for the value. The code

> snippet is:
> 
> $('#mySelect [EMAIL PROTECTED]').val();
> 
> You can see it here:
> 
> http://www.intoajax.com/selecttest.htm
> 
> Any ideas on how to fix this?
> 
> Rey...
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 

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

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

Reply via email to