$(document).ready(function(){ $.fn.zTree.init($("#treeDemo"), setting, zNodes); }); function onCheck(e,treeId,treeNode){ var treeObj=$.fn.zTree.getZTreeObj("treeDemo"), nodes=treeObj.getCheckedNodes(true), v=""; for(var i=0;i<nodes.length;i++){ v+=nodes[i].name + ","; alert(nodes[i].id); //获取选中节点的值 } }