Note that there are some explanatory texts on larger screens.

plurals
  1. PODisable <li> tag contents using javascript
    primarykey
    data
    text
    <pre><code>var inputs = document.getElementsByTagName("li"); for(var i = 0; i &lt; inputs.length; i++) { if(inputs[i].id.indexOf(startsWith) == 0) { eles.push(inputs[i].id); } } for(var j=0; j &lt; eles.length; j++) { document.getElementById(eles[j]).setAttribute("class","jstree-checked"); } </code></pre> <p>Am taking out the ids that starts with certain pattern in the <code>li</code> tags of my document.<br/> I am changing the class of the <code>li</code> tags of the resulting ids.<br/> I also need to disable the contents present in the <code>li</code> tag as a whole.<br/> Is it possible to do this using javascript or jquery? </p> <p><strong>UPDATE:</strong><br/> I've a checkbox and text message inside each <code>&lt;li&gt;</code> tag.<br/> Need to disable the checkbox(non clickable) and display the text as disabled.</p> <pre><code>&lt;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"&gt; &lt;ins class="jstree-icon"&gt; &lt;/ins&gt; &lt;a class="" href="#" style=""&gt; &lt;ins class="jstree-checkbox"&gt; &lt;/ins&gt; &lt;ins class="jstree-icon "&gt; &lt;/ins&gt; fusionEAR.ear &lt;/a&gt; &lt;/li&gt; </code></pre> <p>Tried these:</p> <pre><code>for(var j=0; j &lt; 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 } </code></pre> <p>In any of these tries I couldnt find my checkbox disabled. But the task of selecting the check box is successful for required ids by changing the class name inside the loop as given.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload