jQuery 复选框树被选中
我有一个使用 jQuery 的复选框树。这是 tree_data.json 的代码:
[{
"id":1,
"text":"Administrator",
"children":[{
"id":2,
"text":"Cpanel",
"state":"open",
"children":[{
"id":3,
"text":"Activator",
"state":"closed",
"children":[{
"text":"Delete"
},{
"text":"Edit"
},{
"text":"New"
},{
"text":"View"
}]
}]
}]
}]
对于视图来说是这样的,
<table border="1" width="500"><tr><td>
<ul id="tt" class="easyui-tree" url="data/tree_data.json" checkbox="true">
</ul>
</td></tr>
<tr><td>Your selected role are : </td></tr>
</table>
<table><tr><td>Your selected role are <input type="text" /></td></tr></table>
我的视图的输出是这样的:
[]Administrator
[]Cpanel
[]Activator
[]Delete
[]Edit
[]New
[]View
我想问如何获取我的复选框值。
示例:如果我选中“删除”和“编辑”,那么
您选择的角色是:“Activator_Delete”、“Activator_Edit”
感谢您的帮助
编辑:
我是 jQuery 的新手,所以请帮助我给我一些例子,不是链接
谢谢
I have a checkbox tree using jQuery. Here's the code for tree_data.json :
[{
"id":1,
"text":"Administrator",
"children":[{
"id":2,
"text":"Cpanel",
"state":"open",
"children":[{
"id":3,
"text":"Activator",
"state":"closed",
"children":[{
"text":"Delete"
},{
"text":"Edit"
},{
"text":"New"
},{
"text":"View"
}]
}]
}]
}]
and for the view is like this
<table border="1" width="500"><tr><td>
<ul id="tt" class="easyui-tree" url="data/tree_data.json" checkbox="true">
</ul>
</td></tr>
<tr><td>Your selected role are : </td></tr>
</table>
<table><tr><td>Your selected role are <input type="text" /></td></tr></table>
the output for my view is like this:
[]Administrator
[]Cpanel
[]Activator
[]Delete
[]Edit
[]New
[]View
I want to ask how to get my checkbox value.
Example : if I checked "Delete" and "Edit" then
Your selected role are : "Activator_Delete","Activator_Edit"
Thanks for helping
EDIT:
I'm new to use jQuery, so please help me with giving me some example, not link
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用easyui树的getChecked方法:
这里是.tree方法列表。
Use the getChecked method of the easyui tree:
Here's the .tree method list.