0
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");                
}

Am taking out the ids that starts with certain pattern in the li tags of my document.
I am changing the class of the li tags of the resulting ids.
I also need to disable the contents present in the li tag as a whole.
Is it possible to do this using javascript or jquery?

UPDATE:
I've a checkbox and text message inside each <li> tag.
Need to disable the checkbox(non clickable) and display the text as disabled.

<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>

Tried these:

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
        }

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.

LGAP
  • 2,365
  • 17
  • 50
  • 71
  • I'm not seeing a checkbox in your html – Jon P Jan 23 '13 at 05:09
  • Its a checkbox that is generated by jstree automatically. hence only class name is there I suppose. – LGAP Jan 23 '13 at 05:12
  • Further more can you provide an example of in ID that would be disabled and one that would not – Jon P Jan 23 '13 at 05:13