Hi, I need some help shortening this code and am just a little off. Here is original code:
$("#MKDPT").change(function() {
if ($("#MKDPT").is(":checked") && $("#AMX1N").is(":not(:checked)") ||
("#ERXXN").is(":not(:checked)")) {
alert(this.id);
}
});
I will be adding a lot more id's. Can I just create an array of the ID's im making sure aren't checked and compare against it? Im not sure if you can check to see if any item in an array is checked, or do I need to do it by .length?
Example
$("#MKDPT").change(function() {
if ($("#MKDPT").is(":checked") && $("#AMX1N").is(":not(:checked)") ||
("#ERXXN").is(":not(:checked)") || ("#ID").is(":not(:checked)") || ("#ID").is(":not(:checked)") ||
("#ID").is(":not(:checked)") || ("#ID").is(":not(:checked)") || ("#ID").is(":not(:checked)")) {
alert('foo');
}
});
this is what I want it to do, but am having trouble with:
$("#MKDPT").change(function() {
var ckd = new Array = ("AMX1N","ERXXN","ID","ID","ID","ID","ID","ID","ID")
if ($("#MKDPT").is(":checked") && ckd.is(":not(:checked)")) {
alert('foo');
}
});
Kane Leins