jQuery API 返回首页目录 | jQuery API 中英文对照版
val
val()

获得第一个匹配元素的当前值。

返回值:String

示例:

$("input").val();

HTML 代码:

<input type="text" value="some text"/>

结果:

"some text"

 
val()

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. For more robust handling of field values, see the fieldValue function of the Form Plugin.

Return value: String
Example:

 $("input").val();  
Before:
 <input type="text" value="some text"/>  
Result:
 "some text"  
相关链接
asp之家 | jQuery官方网站 | jQuery中文网 | 电子书作者网站 | 电子书作者blog