jQuery MiniUI
标题:
checkboxList取值问题
[打印本页]
作者:
tizzyg
时间:
2017-3-9 10:20:58
标题:
checkboxList取值问题
checkboxList有一个valuechanged事件,是否有办法获取这个事件触发之前checkboxList的值呢??
作者:
jialiang
时间:
2017-3-9 11:30:45
本帖最后由 jialiang 于 2017-3-9 12:06 编辑
你可以用onbeforeselect事件来获取改变值之前的值(这里是代码,复制粘贴就可使用):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="http://www.miniui.com/scripts/boot.js" type="text/javascript"></script>
</head>
<body>
<div id="demo1" class="mini-checkboxlist" textField="text" valueField="id" value="cn,usa"
repeatItems="3" repeatLayout="table" onvaluechanged="change()" onbeforeselect="alert(this.getValue())">
</div>
<script>
mini.parse();
var s = [
{ "id": "usa", "text": "美国" },
{ "id": "cn", "text": "中国" },
{ "id": "jp", "text": "日本", enabled: false },
{ "id": "de", "text": "德国" },
{ "id": "fr", "text": "法国" },
{ "id": "ca", "text": "加拿大" },
{ "id": "at", "text": "奥地利" },
{ "id": "ch", "text": "瑞士" }
];
var cblist1 = mini.get("demo1");
cblist1.loadData(s);
function change() {
alert(cblist1.getValue());
}
</script>
</body>
</html>
复制代码
欢迎光临 jQuery MiniUI (http://miniui.com/discuss/)
Powered by Discuz! X2