.NET Programming
--
Questions
--
Followers
Top Experts
JSTree Parent Node Text
Hello Experts,
I am using JSTree plugin to display my Data.
But when I select the Child node, I wanted to get the Parent node Text on form submit.
I have tried below code.
Another issue is when Checked the Parent node, then all child nodes are selected. But I am not getting that selected parent node using below code
var selectedElms =$js('#IndustryTree').jstr ee("get_se lected", true);

This code is working when I particularly select the Child node, in this case, parent node CSS class will be jstree-icon jstree-checkbox jstree-undetermined

Any help would be appreciated
I am using JSTree plugin to display my Data.
But when I select the Child node, I wanted to get the Parent node Text on form submit.
I have tried below code.
$(document).on('click', '#btnSubmit', function () {
var parent = [];
var selectedElms =$js('#IndustryTree').jstree("get_selected", true);
$.each(selectedElms, function () {
selectedElmsIds.push(this.text);
//parent.push(this.parent);
var node = $js('#IndustryTree').jstree(true).get_node(this.parent, true);
var Parentnode = $js('#IndustryTree').find("[id='" + this.parent + "']");
parent.push(Parentnode[0].innerText);
});
});
But When I run this code, in Parentnode[0].innerText I am getting Parent Node text as well as all Child node text. So it is difficult to differentiate the Parent Node Text.Another issue is when Checked the Parent node, then all child nodes are selected. But I am not getting that selected parent node using below code
var selectedElms =$js('#IndustryTree').jstr

This code is working when I particularly select the Child node, in this case, parent node CSS class will be jstree-icon jstree-checkbox jstree-undetermined

Any help would be appreciated
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Can you post a piece of the HTML code to work more efficiently?
Hi,
I am binding the values from server side in .NET MVC.
So there is just a div to generate the tree.
The main operation is in javascript
I am binding the values from server side in .NET MVC.
So there is just a div to generate the tree.
The main operation is in javascript
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Hi,
I got the Parent node now when I select the Child node instead of Parent Node.
Now, when I am selecting the Parent node directly, all the child node are selecting, But I am not getting the text values of parent as well as child nodes
How can I get it ?
I got the Parent node now when I select the Child node instead of Parent Node.
Now, when I am selecting the Parent node directly, all the child node are selecting, But I am not getting the text values of parent as well as child nodes
How can I get it ?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
The code posted by me is working for me.
.NET Programming
--
Questions
--
Followers
Top Experts
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.