0
点赞
收藏
分享

微信扫一扫

combo下拉列表选择

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Basic Combo - jQuery EasyUI Demo</title>

<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">

<link rel="stylesheet" type="text/css" href="../../themes/icon.css">

<link rel="stylesheet" type="text/css" href="../demo.css">

<script type="text/javascript" src="../../jquery.min.js"></script>

<script type="text/javascript" src="../../jquery.easyui.min.js"></script>

</head>

<body>

<h2>Basic Combo</h2>

<p>Click the right arrow button to show drop down panel that can be filled with any content.</p>

<div style="margin:20px 0"></div>


<select id="cc" style="width:190px"></select>

<div id="sp">

<div style="color:#99BBE8;background:#fafafa;padding:5px;">Select a language</div>

<div style="padding:10px">

<input type="radio" name="lang" value="01"><span>Java</span><br/>

<input type="radio" name="lang" value="02"><span>C#</span><br/>

<input type="radio" name="lang" value="03"><span>Ruby</span><br/>

<input type="radio" name="lang" value="04"><span>Basic</span><br/>

<input type="radio" name="lang" value="05"><span>Fodrtran</span>

</div>

</div>

<script type="text/javascript">

$(function(){

$('#cc').combo({

required:true,

editable:false,

value:'appp'

});

/*主要同通过panel属性进行关联*/

$('#sp').appendTo($('#cc').combo('panel'));


$('#sp input').click(function(){

// $(this).val();获取某个元素节点的value值,

// 相当于$(this).attr(“value”);

                /*选择的值*/

var v = $(this).val();

/*获取点击的input的同级span对象,这也是重点*/

var s = $(this).next('span').text();

//

$('#cc').combo('setValue', v);//值

$('#cc').combo('setText', s);//文本

$('#cc').combo('hidePanel'); //隐藏弹出面板

});

});

</script>

</body>

</html>


举报

相关推荐

0 条评论