Search code examples
javascriptjquerydhtmlx

Highlighting the text when editing an item from the dhtmlx tree


When I want the user to rename an item from the tree, I open the editor for him:

 tree.editItem(tree.getSelectedItemId());

But I want the text in the editor to be selected (highlighted). Now the cursor is in the end of the text and the text isn't selected. How to do this?


Solution

  • Use this

    document.getElementById('id').select();
    

    here is working example jsfiddle