我正在使用jqxWidgets树状菜单似乎无法找到一种方法来捕获jquery中标签的click事件。有没有办法在jquery中捕获此标签进行处理?我已经包含了相关的代码片段,非常感谢您的专业建议。非常感谢
<script type="text/javascript">
$(document).ready(function () {
var source = [
{ label: "Weekly Reports", expanded: false, items: [
{ label: "Intake" },
{ label: "Retrieval", selected: false },
{ label: "Returns", selected: false }
]
},
/*{ label: "Item 2" },
{ label: "Item 3" },*/
{ label: "Monthly Reports", items: [
{ label: "Item 4.1" },
{ label: "Item 4.2" }
]
},
/*{ label: "Item 5" },
{ label: "Item 6" },
{ label: "Item 7" }*/
{ label: "Movement Reports", items: [
{ label: "Item 4.1" },
{ label: "Item 4.2" }
]
},
{ label: "Destruction Reports", items: [
{ label: "Item 4.1" },
{ label: "Item 4.2" }
]
},
];
var theme = "";
// Create jqxTree
$("#jqxTree").jqxTree({ source:source, theme: theme });
// Create jqxExpander
$("#jqxExpander").jqxExpander({ showArrow: false, toggleMode: "none", width: "262px", height: "auto", theme: theme });
});
</script>
答案 0 :(得分:0)
jqxTree有select
事件的内置回调。您可以捕获此事件并检索单击的标签,如下所示:
$('#jqxTree').on('select',function (event){
var args = event.args;
var item = $('#jqxTree').jqxTree('getItem', args.element);
var label = item.label;
});