How to use variable in JQuery select -
how modify jquery use var instead of '12'?
var disableid = 12; if (e.currenttarget.checked) { $("input:checkbox[value=12]").attr("disabled", true); } else { $("input:checkbox[value=12]").attr("disabled", false); }
you should use jquery's prop()
method instead of attr()
boolean values; there's no need if statements @ can set disabled
state equal e.currenttarget.checked
(which either true
or false
):
var disableid = 12, state = e.currenttarget.checked; $("input:checkbox[value='" + disableid + "']").prop("disabled", state);
Comments
Post a Comment