国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
.val() | jQuery API Documentation

.val()     Returns: String or Number or Array


Description: Get the current value of the first element in the set of matched elements.

  • version added: 1.0

    • This method does not accept any arguments.

The .val() method is primarily used to get the values of form elements such as input, select and textarea. When called on an empty collection, it returns undefined.

When the first element in the collection is a select-multiple (i.e., a select element with the multiple attribute set), .val() returns an array containing the value of each selected option. As of jQuery 3.0, if no options are selected, it returns an empty array; prior to jQuery 3.0, it returns null.

For selects, checkboxes and radio buttons, you can use :checked to select the right elements. For example:

1
2
3
4
5
6
7
8
9
10
11
// Get the value from the selected option in a dropdown
$( "select#foo option:checked" ).val();
// Get the value from a dropdown select directly
$( "select#foo" ).val();
// Get the value from a checked checkbox
$( "input[type=checkbox][name=bar]:checked" ).val();
// Get the value from a set of radio buttons
$( "input[type=radio][name=baz]:checked" ).val();


Note: At present, using .val() on <textarea> elements strips carriage return characters from the browser-reported value. When this value is sent to the server via XHR, however, carriage returns are preserved (or added by browsers which do not include them in the raw value). A workaround for this issue can be achieved using a valHook as follows:


本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
用Jquery獲取checkbox多個選項
JQUERY獲取text,areatext,radio,checkbox,select值
jQuery對select操作小結(jié) - 鬼鬼DH - 博客園
jquery判斷一組checkbox中是否至少選中了一個
jquery的checkbox,radio,select等方法總結(jié)
checkbox在jquery版本1.9 以上用attr不可重復(fù)操作的問題【附解決方案】
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服