title: How to rename a node right after creation with jsTree jQuery plugin?
body: <p>I use the jsTree plugin to create a directory tree.</p>
  <p>Right click a node, should open a <code>contextmenu</code> where the user can create a new child node and assign a custom name to it.</p>
  <p>So everything works fine except renaming the node.</p>
  <p>I did following:</p>
  <pre><code>//create node (inside handler of contextmenu) 
  self.dirtree.jstree(true).create_node('#' + $(this).attr('id'));
  
  //open node and edit it (inside event handler)
  if (event.type == 'create_node') {
      self.dirtree.jstree(true).open_node('#' + data.node.parent);
      self.dirtree.jstree(true).edit($('#' + data.node.parent).find('&gt; ul').find('&gt; li').last(), &quot;Neuer Ordner&quot;);
  }
  </code></pre>
  <p>The event is triggered and the parent node is also opened but the edit only removes the node name and not shows an inputfield as expected.
  if I only call open_node, it looks like:</p>
  <p><a href="https://i.stack.imgur.com/sK6nO.png" rel="nofollow noreferrer">new node output without edit</a></p>
  <p>when I also call edit:</p>
  <p><a href="https://i.stack.imgur.com/jpiyr.png" rel="nofollow noreferrer">new node output with edit</a></p>
  <p>I'm not sure what's going wrong. Since edit changes the node, the selection should be fine.</p>
  <p>If I call edit after create_node (in the handler of the contextmenu), everything works.</p>
  <pre><code>self.dirtree.jstree(true).create_node('#' + $(this).attr('id'));
  self.dirtree.jstree(true).open_node('#' + $(this).attr('id'));
  self.dirtree.jstree(true).edit($('#n-' + $(this).attr('id')).find('&gt; ul').find('&gt; li').last(), &quot;Neuer Ordner&quot;);
  </code></pre>
  <p><a href="https://i.stack.imgur.com/dok6Z.png" rel="nofollow noreferrer">call all functions in the handler of contextmenu output</a></p>
  <p>Is it even posible to call edit in the event handler?</p>