Skip to content Skip to sidebar Skip to footer

Can We Go One Level Up Node Using Jquery?

I make a demo of tree view using jstree .I am able to move next and previous element selectable. Ecample Click 'b' now it is selectable and then press next and previous it it move

Solution 1:

Try this,

$('#onelvel').click(function () {
    if($('.jstree-clicked').length){
        $('.jstree-clicked').click();
        if($('.jstree-clicked').closest('.jstree-children').prev('.jstree-anchor').length){
            $('.jstree-clicked').removeClass('.jstree-clicked');
            $('.jstree-clicked').closest('.jstree-children').prev('.jstree-anchor').addClass('.jstree-clicked');
        }
    }
});

Live Demo

Updated try this,

$('#onelvel').click(function () {
    if($('.jstree-clicked').length){
        if($('.jstree-clicked').next('.jstree-children').length){
            $('.jstree-clicked').click();
        } else {
            $('.jstree-clicked').closest('.jstree-children').prev('.jstree-anchor').click().addClass('jstree-clicked');
        }         
    }
});

Updated demo


Post a Comment for "Can We Go One Level Up Node Using Jquery?"