如何在javascript中打开jstree分支

时间:2015-06-20 07:01:16

标签: javascript jstree

这是html代码:

<div id="jstree-beanDescCategorie" class="jstreeDiv" style="display: none;">

<div class="containerjsTree jstree jstree-2 jstree-default jstree-checkbox-selection" role="tree" aria-multiselectable="true" tabindex="0" aria-activedescendant="3" aria-busy="false">

<ul class="jstree-container-ul jstree-children jstree-wholerow-ul jstree-no-dots" role="group">

  <li id="2" class="jstree-node jstree-closed" role="treeitem" aria-selected="false" aria-level="1" aria-labelledby="2_anchor" aria-expanded="false">

  <div class="jstree-wholerow" unselectable="on" role="presentation"></div>
  <i class="jstree-icon jstree-ocl" role="presentation"></i>
  <a id="2_anchor" class="jstree-anchor" href="#" tabindex="-1"></a>

  </li>

当分支打开时,类会更改为&#34; jstree-node jstree-open&#34;

我使用Tchromium嵌入delphi 我试过了:

 var x = document.getElementsByClassName("jstree-node jstree-closed");
 x[1].click();

没有发生任何事情,虽然x不是空的

1 个答案:

答案 0 :(得分:0)

您不应该更改类,而是获取实例并在其上调用knife cookbook

open_node