How to select a specific node programmatically?

前端 未结 9 1099
小鲜肉
小鲜肉 2021-02-02 07:18

I have a jstree. I want to select the node which is bound to the object which has a location with id of 158. This works but seems stupid. What\'s the more idiomatic way of doing

9条回答
  •  我在风中等你
    2021-02-02 07:52

    trigger click on first anchor

    $("#jstree .jstree-anchor:first").click(); 
    

    or by node id 158

    $("#jstree #158").find(".jstree-anchor:first").click(); 
    
    $('#' + 158).find(".jstree-anchor:first").click(); 
    

提交回复
热议问题