I have to admit, I didn't understand that $.val() was limited to only input elements, and I expected it to get the value of any element.

The API says that $.val() will:
    Get the current value of the first matched element.

The API says that $.val( string ) will:
    Set the value of every matched element.

The only indications in the API that this only works on the input element is that the examples following both methods use the input element. There's no other indication, so I am surprised to find that it only works on this element.

Chris

Alex Cook wrote:
*raises hand*

Yea, that'd be nice... I expected $.val() to return the value of any and
all form elements, and was disappointed to find out otherwise.

-ALEX

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On
Behalf Of Brandon Aaron
Sent: Tuesday, November 14, 2006 6:32 PM
To: jQuery Discussion.
Subject: [jQuery] $.val() limited in functionality?

I often times just need to know the value of one form element and
sometimes that could be a group of radio buttons, a select, a multiple
select or just a regular input. The current $.val() method is limited
only to inputs. I was curious if anyone else needed this funtionality
and if it should be in a plugin or in the core?

--
Brandon Aaron

_______________________________________________
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