The id of the selected node. Read Only.
String, default = ''
Each node has .selected property that determines if the node is selected. It is time consuming to loop through all the nodes to find selected, therefore the .selected property was added. It holds the id of the last selected node. You can use .select() and .unselect() to select/unselect nodes.
You can define it during object creation: $('#sidebar').w2sidebar({ name : 'sidebar', icon : 'fa fa-start', nodes: [ { id: 'id-1', text: 'Level 1' }, { id: 'id-2', text: 'Level 2' }, { id: 'id-3', text: 'Level 3' } ] }); You can find selected node by. console.log( w2ui['sidebar'].selected );