bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

如何獲取select下拉框的選中值

這篇文章主要講解了“如何獲取select下拉框的選中值”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“如何獲取select下拉框的選中值”吧!

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名注冊(cè)網(wǎng)站空間、營(yíng)銷軟件、網(wǎng)站建設(shè)、西湖網(wǎng)站維護(hù)、網(wǎng)站推廣。

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script>
<!--<script src="http://libs.baidu.com/jquery/1.6.4/jquery.min.js"></script>-->
<!--<script src="http://libs.baidu.com/jquery/1.5.2/jquery.min.js"></script>-->
<!--<script src="http://libs.baidu.com/jquery/1.4.4/jquery.min.js"></script>-->
<!--<script src="http://libs.baidu.com/jquery/1.3.2/jquery.min.js"></script>-->
<!--<script src="http://libs.baidu.com/jquery/1.2.3/jquery.min.js"></script>-->
<style type="text/css">
</style>
</head>
<body>
<form action="" id="form">
<select id="sl">
<option selected="true" value="0">第一個(gè)</option>
<option value="1">第二個(gè)</option>
<option value="2">第三個(gè)</option>
</select>
</form>
</body>
</html>
<script type="text/javascript" language="javascript">
//獲取值
alert($("#sl option:selected").val());
alert($("#sl").find("option:selected").text());
alert($("#sl").val());

//獲取選中option的索引
alert($("#sl ").get(0).selectedIndex);
alert($('#sl').prop('selectedIndex'));
alert($('#sl').find('option:selected').index());
alert($('#sl').prop('selectedIndex'));
alert($('#sl option').index($('#sl option:selected')));

//設(shè)置select 選中的value:
$("#sl ").attr("value", "1");
$("#sl ").val("1");
$("#sl ").get(0).value = 1;

//設(shè)置select的option選項(xiàng)
$("#sl").append("<option value='4'>第四個(gè) 添加的</option>"); //添加一項(xiàng)option
$("#sl").prepend("<option value='-1'>最前邊 添加的</option>"); //在前面插入一項(xiàng)option
$("#sl option:last").remove(); //刪除索引值最大的option
$("#sl option[value='2']").remove(); //刪除值valuie為2的option
$("#sl option[index='0']").remove(); //刪除索引值為0的option  jquery1.6以后就不支持這樣刪除了
$("#sl option[text='第三個(gè)']").remove(); //刪除text值為4的option jquery 1.2以后就不支持了

//清空select的所有option
$("#sl ").empty();
</script>http://www.2799999.com

感謝各位的閱讀,以上就是“如何獲取select下拉框的選中值”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)如何獲取select下拉框的選中值這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

分享文章:如何獲取select下拉框的選中值
分享URL:http://vcdvsql.cn/article12/iigcgc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化面包屑導(dǎo)航App設(shè)計(jì)軟件開(kāi)發(fā)網(wǎng)頁(yè)設(shè)計(jì)公司網(wǎng)站收錄

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁(yè)設(shè)計(jì)公司