Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
Get All Selected Node values in JS Tree

I'm currently using js tree. I want to get the all selected node object.

Following is how I populate my jstree.

My JS Code

   $(function () {

        $('#data').jstree({
            'core': {
                'data': [
                    {
                        "text": "Administration",
                        "children": [
                            {
                                "text": "Admin",
                                "children": [
                                    {
                                        "text": "Access",
                                        "children": [
                                            { "id": "1", "text": "Add" },
                                            { "id": "2", "text": "Edit" },
                                            { "id": "3", "text": "Delete" },

                                        ]
                                    },

                                ]
                            }
                        ]
                    }
                ]
            },
            'checkbox': {
                three_state: false,
                whole_node: false,    // should be set to false. otherwise checking the hidden checkbox
                // could be possible by clicking the node
                tie_selection: false, // necessary for whole_node to work
                cascade: 'up down'
            },
            'plugins': ["checkbox"]


        },

        ).bind("loaded.jstree", function (event, data) {

            $(this).jstree("open_all");

            $('.btnGetCheckedItem').click(function () {
                var checked_ids = [];
                var selectedNodes = $('#data').jstree("get_selected", true);
                console.log(selectedNodes);
                $.each(selectedNodes, function () {
                    /*  console.log(this.original);*/
                    checked_ids.push(this.id);
                });

                
                $('#idshow').text(checked_ids);
            });

        });

    });

HTML

  <div id="data"></div>
  <input class="btnGetCheckedItem" value="Get all checked items" type="button" />

I am trying this code but I am not getting the selected node object. I am taking this from the jstree documents Please let me know if you have any idea where I am doing something wrong?

Thank you

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!