怎么写jquery easyui combotree 的onSelect事件,大侠们帮帮忙啊
<html><head><metahttp-equiv="Content-Type"content="text/html;charset=UTF-8"><title>jQ...
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jQuery EasyUI</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../themes/icon.css">
<script type="text/javascript" src="../jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<script type="text/javascript" src="../jquery.combotree.js"></script>
<script>
function reload(){
$('#cc').combotree('reload');
}
function setValue(){
$('#cc').combotree('setValue', 2);
}
function getValue(){
var val = $('#cc').combotree('getValue');
alert(val);
}
function disable(){
$('#cc').combotree('disable');
}
function enable(){
$('#cc').combotree('enable');
}
$('#cc').combotree({
onSelect:function(node) {
alert("dd");
}
})
</script>
</head>
<body>
<h1>ComboTree</h1>
<div style="margin-bottom:10px;">
<a href="#" onclick="reload()">reload</a>
<a href="#" onclick="setValue()">setValue</a>
<a href="#" onclick="getValue()">getValue</a>
<a href="#" onclick="disable()">disable</a>
<a href="#" onclick="enable()">enable</a>
</div>
<span>Select:</span>
<input id="cc" class="easyui-combotree" url="tree_data.json" value="2" required="true" style="width:200px;" >
<select id="ccClassTree" class="easyui-combotree" name="language" url="tree_data.json" multiple="true" cascadeCheck="false" style="width:200px;"></select>
</body>
</html> 展开
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jQuery EasyUI</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../themes/icon.css">
<script type="text/javascript" src="../jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<script type="text/javascript" src="../jquery.combotree.js"></script>
<script>
function reload(){
$('#cc').combotree('reload');
}
function setValue(){
$('#cc').combotree('setValue', 2);
}
function getValue(){
var val = $('#cc').combotree('getValue');
alert(val);
}
function disable(){
$('#cc').combotree('disable');
}
function enable(){
$('#cc').combotree('enable');
}
$('#cc').combotree({
onSelect:function(node) {
alert("dd");
}
})
</script>
</head>
<body>
<h1>ComboTree</h1>
<div style="margin-bottom:10px;">
<a href="#" onclick="reload()">reload</a>
<a href="#" onclick="setValue()">setValue</a>
<a href="#" onclick="getValue()">getValue</a>
<a href="#" onclick="disable()">disable</a>
<a href="#" onclick="enable()">enable</a>
</div>
<span>Select:</span>
<input id="cc" class="easyui-combotree" url="tree_data.json" value="2" required="true" style="width:200px;" >
<select id="ccClassTree" class="easyui-combotree" name="language" url="tree_data.json" multiple="true" cascadeCheck="false" style="width:200px;"></select>
</body>
</html> 展开
1个回答
展开全部
$('#cc').combotree({
onSelect:function(node) {
alert("dd");
}
})
基本是这样了,但要页面加载后执行哇! 加上$(function(){//...});
为了不混淆,html加个新的id吧 <input id="dd" style="width:200px;" ></input>
js:
$(function(){
$('#dd').combotree({url:"tree_data.json",onSelect:function(node){alert(node.text);}});
});
onSelect:function(node) {
alert("dd");
}
})
基本是这样了,但要页面加载后执行哇! 加上$(function(){//...});
为了不混淆,html加个新的id吧 <input id="dd" style="width:200px;" ></input>
js:
$(function(){
$('#dd').combotree({url:"tree_data.json",onSelect:function(node){alert(node.text);}});
});
参考资料: easyUi手册
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询