I am trying to disable a checkbox if its name matches a value in an array.
<input type="checkbox" name="check1" value="v1" class="hello">
<input type="checkbox" name="check2" value="v2" class="hello">
<input type="checkbox" name="check3" value="v3" class="hello">
In JQuery,
function set(chk) {
var dict = {"key1": ["check1"], "key2": ["check1", "check2"]};
for (var i=0: i< dict[chk].length : i++) {
var value = dict[chk][i];
$("input[name=value]").prop("disabled", true);
}
}
For example, in the key2 case, I'd like to disable check1 and check2. How can I pass the value to the checkbox input in JQuery?
Aucun commentaire:
Enregistrer un commentaire