I'm currently creating a function that goes through an array and checks to see if values exist. If values do exist then it's suppose to allow the checkboxes to be clicked. The problem is for some reason it isn't enabling the checkboxes. It is going into the if statement as the alert is printing but it isn't changing the attributes. Changing from attr to prop makes no difference in this case either way it isn't doing what its suppose to. This is the updated code I have..
var values = this.value();
var total = ["1", "2", "3", "4", "5"];
var group = "";
for (number in values) {
if ($.inArray(values[number], total) != -1) {
group = "group" + values[number];
$("input." + group).prop("disabled", false);
alert("Group: " + group + " Values: " + values[number] + " The values DO match");
}
else {
group = "group" + values[number];
$("input." + group).prop("disabled", true);
$("input." + group).prop("checked", false);
alert("Group: " + group + " Values: " + values[number] + " The values do not match");
}
}
Now the code I'm listing below completely works. The only difference is hardcoded class values versus variables above.
if ($.inArray("1", values) != -1 || $.inArray("2", values) != -1)
{
$("input.group1").prop("disabled", false);
}
else
{
$("input.group1").prop("disabled", true);
$("input.group1").prop("checked", false);
}
I am using Kendo UI MVC. I've copied the source information for the Multiselect. Here is the JFiddle with the code. http://jsfiddle.net/gS2C8/