87,910
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYP>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="jqueryeasyui/themes/default/easyui.css">
<script src="jquery.js"></script>
<script src="jqueryeasyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="jqueryeasyui/locale/easyui-lang-zh_CN.js"></script>
</head>
<body>
<input id="cc" name="dept" value="aa">
<input id="txt" type="input" />
<script>
$('#cc').combobox({
url:'combobox_data.json',
valueField:'id',
textField:'text',
onSelect: function(){
$('#txt').val($('#cc').combobox('getValue')+":"+$('#cc').combobox('getText'));
}
});
</script>
</body>
</html>
json文件:
[{
"id":1,
"text":"text1"
},{
"id":2,
"text":"text2"
},{
"id":3,
"text":"text3",
"selected":true
},{
"id":4,
"text":"text4"
},{
"id":5,
"text":"text5"
}]