I Have a TreeView with ShowCheckBox(true). How can get all values of checked nodes in second level with JQuery.
1 Answer
This is about jQuery selectors:
To retrieve the values of the checked checkboxes only for the second level as array you can use the following line of code.
var array = $('#TreeViewName>ul>li>ul>li>div :checked').map(function(){ return this.value});
To get the text of a node or the value you should use the corresponding method - getItemText or getItemValue
There are example in the documentation :
var treeview = $('#ProductsTreeView').data('tTreeView');
var nodesSecondLevel= $("#TreeView1>ul>li :has(>div :checked)");
var arrayOfValue = nodesSecondLevel.map(function(){
return treeview.getItemValue(this);
})
1 Comment
Majid Shamkhani
Thanks, But I want value of node not checkbox.