Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9165147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:50:45+00:00 2026-06-17T14:50:45+00:00

var inputs = document.getElementsByTagName(li); for(var i = 0; i < inputs.length; i++) { if(inputs[i].id.indexOf(startsWith)

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:50:46+00:00Added an answer on June 17, 2026 at 2:50 pm

    the types plugin can be used to customize the nodes in jstree.

     types: {
        "disabled": {
            "select_node": false,
            "open_node":   false,
            "close_node":  false,
            "create_node": false,
            "delete_node": false
        }
    }
    

    Note we defined a Type and named it as disabled, so we have add the attribute rel as disabled to the <li> element to make it disabled. This is how jsTree look for type using the rel attribute.

    with the Type being declared, in your loop just add,

    document.getElementById(eles[j]).setAttribute("rel","disabled");
    

    I hope this helps you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function confirm_results(theform) { var inputsX = document.getElementById(theform).getElementsByTagName('textarea'); for(var iX = 0, nX = inputsX.length
$(document).ready(function() { function countChecked() { var n = $(input:checked).length; $(div).text(n + (n <= 1
I have the followng code: var inputs = document.getElementsByTagName(input); for (var i = 0;
i have the following function function change() { var input = document.getElementById('pas'); var input2
here is my code. I can't make the alert works. var chooseObject = document.getElementsByTagName(input);
script : window.onload = initForms; function initForms() { for (var i=0; i< document.forms.length; i++)
http://jsfiddle.net/wDddR/3/ var input = document.createElement(input); input.onclick = function (ev) { console.log(ev.timeStamp === 0 ?
var brands = document.getElementsByName(brand); for(var brand in brands){ $(input[name='brand']).eq(brand).click(function(){ alert(hello22); loadDataFN(1); }); } This
<script type=text/javascript> $(document).ready(function() { $('input#zip').autocomplete({ var cityAndState = joinedValues.split(|)[1]; dataType: json, source: ../src/php/registration/getFanLoc.php, minLength:
My code is as follows: <script> var i = 2; $(document).ready(function(){ $(#newrow).click(function(){ $(#maintable).append('<tr> <td><input

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.