I know the data-id from the li element, but now i want the id value of the li element. How can I get this? Tried:
var id = $('li[data-id="KnSubject[StId]"]').id; console.log(id); // UNDEFINED Html Code:
<li role="treeitem" data-jstree="{"icon" : "glyphicon glyphicon-pencil"}" data-id="KnSubject[StId]" data-values="null" aria-selected="true" aria-level="3" aria-labelledby="j1_4_anchor" id="j1_4" class="jstree-node jstree-leaf"><i class="jstree-icon jstree-ocl" role="presentation"></i><a class="jstree-anchor jstree-clicked" href="#" tabindex="-1" id="j1_4_anchor"><i class="jstree-icon jstree-themeicon glyphicon glyphicon-pencil jstree-themeicon-custom" role="presentation"></i>Type dossieritem (StId)</a></li>
.idis not a method of jQuery :) Use$('element').attr('id');