You are viewing limited content. For full access, please sign in.

Question

Question

Disable Checkboxs

asked on December 17, 2021 Show version history

Hi all, how can I accomplish this goal. I have a Checkbox selection. If the "All Buildings" box is checked I want the rest of the boxes to be disabled or grayed out for obvious reasons. I don't even want them to be marked in anyway. Just maybe grayed out.

Disable Selections.jpg
0 0

Answer

SELECTED ANSWER
replied on December 19, 2021

Hi Carlos,

Try following script that disable non-first options when first option is selected. 

$(document).ready(function(){
  $("#q1").on("change", function() {
    // Check the option value for "All_Buildings" and disable other options
    if ($("#q1 input:checked").val() == "All_Buildings") {
        $("#q1 input:not(:first)").attr("disabled", "disabled");

    // For all other options, enable other options
    } else {
        $("#q1 input:not(:first)").removeAttr("disabled");
    }
});
})

 

1 0

Replies

replied on December 20, 2021

Thank You!!! It works nicely!!!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.