You should put your js in $(document).ready() like following. Hope this will help you.
js
$(document).ready()
1 $(document).ready(function () { 2 $('#tt').tree({ 3 onClick: function (node) { 4 alert(node.text); 5 } 6 }); 7 });