This is a strange mistake, because it happens when a double-click event occurs. This is why your code does not work, because when you double-click, no change event occurs. Thus, you cannot change the status and remove classes in "onchange". As a fix for this ridiculous problem, I tried adding sth as follows:
$('.limit label').dblclick(function () { if (!$(this).is(':checked')) { $(this).removeClass("ui-state-active ui-state-hover ui-state-focus "); } });
This handles a strange double-click and removes the styles if they are applied incorrectly if the checkbox is not selected.
Asped source share