Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:07:19+00:00 2026-06-15T03:07:19+00:00

I am using the jstree library. A very nice library but I am stuck

  • 0

I am using the jstree library. A very nice library but I am stuck with one problem. The callbacks of the contextmenu do not work.

I made a small working example – it should give an alert when you add / remove / rename nodes, but nothing happens..

Does anyone know why not and what is the solution?

You can see the working- not working example online:
http://www.leermetstrips.nl/Content/tree.htm

Or here:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>JS tree example</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script src="http://code.jquery.com/jquery-1.8.0.js"></script>      
    <script src="http://cachedcommons.org/cache/jquery-jstree/1.0.0/javascripts/jquery-jstree.js" type="text/javascript"> </script>    
<script type="text/javascript">
$().ready( function() {
    var data = [{"data":"Root node","children":[{"data":"node one","children":[],"metadata":[{"action":"action12"}]}],"metadata":[{"action":"action11"}]}];
    $('#tree').jstree(
        {
            json_data: { data: data },
            plugins: ["themes", "json_data", "ui", "contextmenu", "crrm"],
            // TODO: this does not work, why?
            callback: {
                oncreate: function (NODE, REF_NODE, TYPE, TREE_OBJ, RB) {
                    alert('oncreate');
                },
                onrename: function (NODE, LANG, TREE_OBJ, RB) {
                    alert('onrename');
                },
                ondelete: function (NODE, TREE_OBJ, RB) {
                    alert('ondelete');
                }
            }
        }
        );
});
</script>
</head>
<body>
        <h3>JS tree example</h3>
        <p>When adding, or deleting new nodes, there should be an alert. But there is none. Why?</p>
        <div id="tree" style="border:1px solid;"></div> 
        <p>Click on the tree with your right mouse button to add, rename or delete NEW tree nodes.</p>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:07:21+00:00Added an answer on June 15, 2026 at 3:07 am

    There is no callback property in jstree core functionallity.
    So remove this:

        callback: {
            oncreate: function (NODE, REF_NODE, TYPE, TREE_OBJ, RB) {
                alert('oncreate');
            },
            onrename: function (NODE, LANG, TREE_OBJ, RB) {
                alert('onrename');
            },
            ondelete: function (NODE, TREE_OBJ, RB) {
                alert('ondelete');
            }
        }
    

    You need to bind jstree events outside the jstree object this way:

    $('#tree').bind('create.jstree',function (node, ref) {
      alert('oncreate');
    });
    
    $('#tree').bind('rename.jstree',function (node, ref) {
      alert('onrename');
    });
    
    $('#tree').bind('remove.jstree',function (node, ref) {
      alert('ondelete');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first i explain the context then the problem. I am using jstree to transform
Grails 2.1.1 with the resources plugin. I'm using the jstree library and it utilizes
I'm using JSTree and checkbox plugin, but I couldn't managed to pick the nodes
using jstree, i use the next code to Trigger click , but , i
I'm using jstree to create a multi-level tree, and I want to be able
I'm using JsTree stable version from Github and I'm trying the add the logic
I'm using the jstree plugin, with an ajax call. At some point, I call
Im using ajax loading for children nodes in JQuery JsTree plugin. I need to
I am using margin-top in CSS on the jstree as follows: .jstree li a
I am creating a node by using crrm as below $(#TreeDiv).jstree(create, $(#somenode), inside, {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.