Jquery下拉框取值

<!DOCTYPE html>
<html>
<head>
   <title>Bootstrap 实例 - 选择框</title>
   <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
   <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
   <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
   <script>
	   $(function() {
        $("select").change(function(event) {
			////获取当前选择的下一项的值
            //var obj = $(this).find("option:selected").next();
            //alert("选中项的下一个: 内容"+obj.html()+",值"+obj.val());

			//获取当前选择的下一项的值
            var obj = $(this).find("option:selected");
            alert("选中项的: 内容"+obj.html()+",值"+obj.val());
        });
         
    }) 
	</script>
	
	<style>
		select{width:200px;height:500px;padding:10px;border:4px dashed #ccc;}
		select option{margin:5px;}
		input[type='button']{width:200px;height:35px;margin:10px;border:2px dashed #ebbcbe;}
	</style>
</head>
<body>

<form role="form">
   
   <select id="multi-sel" multiple="multiple">
	<option value="1">萝卜,我的value是1</option>
	<option value="2">青菜,我的value是2</option>
	<option value="3">小葱,我的value是3</option>
	<option value="4">豆腐,我的value是4</option>
   </select>
	
</form>

</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值