This is my html ( in twig template )
<li id="{{folder.id}}" data-jstree='{"icon":"glyphicon glyphicon-tags", "type":"folder"}' ><a href="#">{{folder.name}}</a>
I am trying to get the value of 'type' from 'data-jstree'.
I tried using
var node_id = ref.get_node(sel[i]).id;
var type = $("#"+node_id).attr("data-jstree");
but that gives me this : {"icon":"glyphicon glyphicon-tag", "type":"tag"} and i only need the value of type.
Thanks in advance.