If you guys want to use the jQuery and bootstrap icon, here is my solution.
[Note. I use the open bootstrap icon with the closed folder to open the folder and the close-up icon to close the folder.]
// bind customize icon change function in jsTree open_node event. $('#your-jstree').on('open_node.jstree', function(e, data){ $('#' + data.node.id).find('i.jstree-icon.jstree-themeicon').first() .removeClass('glyphicon-folder-close').addClass('glyphicon-folder-open'); }); // bind customize icon change function in jsTree close_node event. $('#your-jstree').on('close_node.jstree', function(e, data){ $('#' + data.node.id).find('i.jstree-icon.jstree-themeicon').first() .removeClass('glyphicon-folder-open').addClass('glyphicon-folder-close'); });
or if you use font-awesome:
// bind customize icon change function in jsTree open_node event. $('#jstree').on('open_node.jstree', function(e, data){ var icon = $('#' + data.node.id).find('i.jstree-icon.jstree-themeicon').first(); icon.removeClass('fa-folder').addClass('fa-folder-open'); }); // bind customize icon change function in jsTree close_node event. $('#jstree').on('close_node.jstree', function(e, data){ var icon = $('#' + data.node.id).find('i.jstree-icon.jstree-themeicon').first(); icon.removeClass('fa-folder-open').addClass('fa-folder'); });
source share