Thursday, September 29, 2011

val()

val() returns String
Get the content of the value attribute of the first matched element.
Use caution when relying on this function to check the value of multiple-select elements and checkboxes in a form. While it will still work as intended, it may not accurately represent the value the server will receive because these elements may send an array of values.

Example:


$("input").val();
HTML:
<input type="text" value="some text"/>
Result:
"some text"

No comments:

Post a Comment