I am not talking about $(\"#demo1\").jstree(\"rename\",node)
which makes the node editable for the user. I am talking about the name being changed within the code.
I believe there is an syntax error with respect to the square braces "[" in the above answer. I use jsTree 3.0.4 and this is the correct syntax -
right - $("#demo1").jstree('set_text',node,text);
wrong - $("#demo1").jstree('rename_node', [node , text] );
Example -
$("#tree_3").jstree('set_text',"#idSelectorForNode" ,"NewName");