[Solved] How to disable / enable checkbox base on select (option) value [closed]


All you have to do is listen to the select and react when it changes.

// Listen to the change of the <select> element
$("#typeofworkday").on("change", function() {
    // Check the option value for "ferie" and disable the checkbox
    if ($(this).val() === "ferie") {
        $("#check1").attr("disabled", "disabled");

    // For all other options, enable the checkbox
    } else {
        $("#check1").removeAttr("disabled");
    }
});

Here’s a JSFiddle of it working

1

solved How to disable / enable checkbox base on select (option) value [closed]