Search code examples
javascriptjqueryhtmlangularjsjstree

Changing color of selected node in jstree


I want to change the background color of my selected node in jstree.

$('#syncrep').jstree({
                                        'core' : {
                                            'data' : repository
                                        }
                                    }).bind("loaded.jstree",
                                    function(event, data) {
                                        $(this).jstree("open_all");
                                    }).on("select_node.jstree",
                                    function(e, data) {

                                        Repository_SelectedNode = $('#syncrep')
                                                .jstree('get_node', data.node);

                                        Repository_SelectedNode_Copy = angular
                                                .copy(Repository_SelectedNode);
                                                });

I tried using an inbuilt API of jstree 'redraw' but it is not serving my purpose.


Solution

  • Can you change style for the .jstree-default .jstree-clicked class?

    See below, also check demo - Fiddle Demo.

    .jstree-default .jstree-clicked {
      background: green;
    }