title: How do I identify a node as being a root node?
body: <p>I want to create a node inside or under an existing node depending on if it is a root node. (a tree widget is usually a list of trees or a tree without a visible root node.)</p>
  
  <p>I tried get_parent, but how do I know if that is a root node? </p>
  
  <pre><code>var parent = $("#demo1").jstree('_get_parent', $("#foo"));
  var node = $("#demo1").jstree('_get_node', $("#foo"));
  </code></pre>
  
  <p>What confused me is that get_node seems to return the same object as get_parent.</p>
  
  <p>I'm using jstree_pre1.0_fix_1.</p>
  
  <p><strong>edited:</strong></p>
  
  <p>I ended up checking for the known id of the parent of the parent.</p>
  
  <pre><code>var node = $(e.replyto);
  if (node.length) {
    if (node.parent().parent().attr('id') == 'demo1') {
      $("#demo1").jstree("create_node", node, 'last',{'attr': {'id':e.id}, 'state':'open', 'data': e.data}) ;
    } else {
      $("#demo1").jstree("create_node", node, 'after',{'attr': {'id':e.id}, 'state':'open', 'data': e.data}) ;
    }
  } else {
      $("#demo1").jstree("create_node", -1, 'after',{'attr': {'id':e.id}, 'state':'open', 'data': e.data});
  }
  </code></pre>