jsTree中获取节点的属性值!

在jsTree的事件onchange中:

onchange: function(NODE, TREE_OBJ) {
  alert($(NODE).attr("id"));
  alert($(NODE).attr("url"));
  alert($(NODE).children("a").text());
}

 

 

后台返回数据为:

[{"attributes":{"id":1,"url":null,"text":"系统管理","leaf":false},"data":{"title":"系统管理","icon":""},"state":"open","c hildren":[{"attributes":{"id":2,"url":"role/show","text":"角色管理","leaf":true},"data":{"title":"角色管理","icon":""}},{ "attributes":{"id":3,"url":"users/show","text":"操作员管理","leaf":true},"data":{"title":"操作员管理","icon":""}}]}] 

 

 

点击图中的“操作员管理”:



 

 

结果分别为:

[code="javascript"]

3

users/show

操作员管理

[/code]

你可能感兴趣的:(JavaScript,C++,c,C#)