[JavaScript][jQuery] How to enable/disable select field?

[jQuery]

$('input[type=radio][name=ldap-sync-type]').change(function() {
    if (this.value == '0') {
        $("select[name=day-option]").prop("disabled", true);
        $("select[name=clock-option]").prop("disabled", true);
    } else if (this.value == '1') {
        $("select[name=day-option]").prop("disabled", false);
        $("select[name=clock-option]").prop("disabled", false);
    }
});

[JavaScript]

$('input[type=radio][name=ldap-sync-type]').change(function() {
    if (this.value == '0') {
        $("select[name=day-option]").attr("disabled", "disabled");
        $("select[name=clock-option]").attr("disabled", "disabled");
    } else if (this.value == '1') {
        $("select[name=day-option]").removeAttr("disabled");
        $("select[name=clock-option]").removeAttr("disabled");
    }
});
This entry was posted in JavaScript, jQuery. Bookmark the permalink.