With the help of answers I found here, I try to disable submit button and send an alert message when clicked on it until there\'s not at least 2 checkboxes checked.
What
You initialize the count of checked checkboxes just once, when your script is first parsed. The count will not be recomputed later. This line:
var selected = $('#frmCompare :checkbox:checked').length;
should be inside the verification function, not outside.