title: jstree select node
body: <p>Greetings, 
  I am using jsTree to generatate my hierarchical data. JsTree is generated as follows:</p>
  
  <pre><code>$(function() {
  $("#industries").tree({
          data: {
              type: "json",
              opts: {
                  url: "/Admin/GetIndustries/"
              }
          }
      });
  });
  </code></pre>
  
  <p>it works find and the jsonresult is something like:</p>
  
  <pre><code>[{"attributes":[],"data":{"title":"Adwokaci, Notariusze","id":"1a051101-c3fa-48f2-b2e1-c60d1b67ea22"},"children":[{"attributes":[],"data":{"title":"Kancelarie adwokackie","id":"26d6cff1-3c7f-4a2f-bf5a-422e08127b43"
  </code></pre>
  
  <p>my question is: how can I save id of selected node in some hidden field? I do something like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $("#industries").click(function() {
          var tree = $.tree.reference("industries");
          var t = $.tree.focused(); if (t.selected) t.selected; else alert("Select a node first");
          alert(t.id);
  
      });
  </code></pre>
  
  <p>but it does not work. I get in my alert window "undefined". Can someone please help me?
      </p>
  
  <p><strong>EDIT:</strong>
  I've changed the jstree instance as follows:</p>
  
  <pre><code>$(function() {
  $("#industries").tree({
          callback: {
              onselect: function(NODE, TREE_OBJ) {
                      alert(NODE.id);
                  }
              },
          data: {
              type: "json",
              opts: {
                  url: "/Admin/GetIndustries/"
              }
          }
      });
  });
  </code></pre>
  
  <p>and i get empty alertt</p>