title: Get Selected Jstree node values JQuery
body: <p>Hi i have problem with getting data of selected node of jstree model.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $('#preview').on("changed.jstree", function (e, data) {
          console.log(data.selected);
          console.log(data.selected.attr("text"));
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>the first console log shows me "[js1_1]" or "[js1_2]" depending on the selected node. But The second log "undefined is not a function" ;/ I have tried many different ways but i failed to achieve getting node text(title) or any other info</p>
  
  <p>I send list of models as json and it looks like this:</p>
  
  <pre><code>Public Class JsTreeModel
     Public Property text As String
     Public Property icon As String
     Public Property Id As String
     Public Property PId As String
     Public Property ParentId As String
     Public Property Status As Integer
  End Class
  </code></pre>
  
  <p>anyone has solution ? </p>
  
  <p>UPDATE jstree code</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function () {
  
      $('#WhenRemoving').toggle($('.RemoveCheckbox').is(":checked"));
      $('#WhenAdding').toggle(!$('.RemoveCheckbox').is(":checked"));
  
      $('#preview').jstree({
          'core': {
              'data': {
                  'url': '/TreeTest/TreePreview/',
                  'data': function (node) {
                      return node;
                  }
              }
          }
      }).bind("loaded.jstree", function (event, data) {
          $(this).jstree("open_all");
      })
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>when i add this to my jstree i can see selected name node in html div </p>
  
  <pre><code>.on('changed.jstree', function (e, data) {
          var i, j, r = [];
          for (i = 0, j = data.selected.length; i &lt; j; i++) {
              r.push(data.instance.get_node(data.selected[i]).text);
          }
          $('#event_result').html('Selected: ' + r.join(', '));
      })
  });
  </code></pre>