var inputs = document.getElementsByTagName("li");
for(var i = 0; i < inputs.length; i++)
{
if(inputs[i].id.indexOf(startsWith) == 0) {
eles.push(inputs[i].id);
}
}
for(var j=0; j < eles.length; j++) {
document.getElementById(eles[j]).setAttribute("class","jstree-checked");
}
li
ドキュメントのタグで特定のパターンで始まる ID を取り出しています。結果のID
のタグのクラスを変更しています。また、タグ全体
に存在するコンテンツを無効にする必要があります。
javascriptまたはjqueryを使用してこれを行うことは可能ですか?li
li
更新:各タグ
内にチェックボックスとテキスト メッセージがあります。
チェックボックスを無効にして(クリック不可)、テキストを無効として表示する必要があります。<li>
<li id="1_1" class="jstree-leaf jstree-no-icons jstree-last jstree-leaf jstree-unchecked" crawllocation="D:\company\deploy\AppServer\fusionEAR.ear" name="fusionEAR.ear">
<ins class="jstree-icon"> </ins>
<a class="" href="#" style="">
<ins class="jstree-checkbox"> </ins>
<ins class="jstree-icon "> </ins>
fusionEAR.ear
</a>
</li>
これらを試しました:
for(var j=0; j < eles.length; j++){
//jQV6('#jstreeDivforBrowse').jstree("check_node","#"+eles[j]);
document.getElementById(eles[j]).setAttribute("class","jstree-default jstree-checked");
//$.jstree._reference('#jstreeDivforBrowse').set_type("disabled", "#"+eles[j]); -- First try to disable
//eles[j].disabled = true;-- Second try to disable
//$("#"+eles[j]).attr('disabled', 'true');-- Third try to disable
//$("#"+eles[j]).addClass("jstree-leaf jstree-no-icons jstree-last jstree-leaf jstree-checked").find(":input").attr("disabled", "disabled");-- Fourth try to disable
}
これらの試行のいずれでも、チェックボックスが無効になっていることがわかりませんでした。ただし、指定されたループ内のクラス名を変更することにより、必要な ID に対してチェック ボックスを選択するタスクは成功します。