$('#tt').tree({ onDblClick: function(node){ if (node.state == 'closed'){ $(this).tree('expand', node.target); } else { $(this).tree('collapse', node.target); } }})