8
I have tried to follow this thread that suggests a solution to check indeterminate states.
I am using ASP.NET, and it seems that clicking a checkbox in indeterminate state will uncheck it, and not fire any event (the underlying checkbox is actually 'unchecked'). I was thinking of having Javascript check it for me when I click a checkbox that is in indeterminate state (prefer the logic this way, and that should fire my ASP.NET event).
$(document).ready(function () {
$(".UndefinedCheckboxState :checkbox").prop("indeterminate", true);
$(":checkbox").click(function () {
if ($(this).prop("indeterminate")) {
$(this).prop("indeterminate", false);
$(this).prop("checked", true);
}
});
});
UPDATE: The click event works fine, but the condition in the if is never true ! I keep clicking checkboxes in indeterminate state though...