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
There is no enabled attribute in HTML.
enabled
$('#btnCompare').prop('disabled', selected < 2);
You also need to recalculate the value of selected at every change, you can't just go with what it was set to at page load.
selected
change