Check if two checkboxes are checked I have a page where a user needs to click two checkboxes before continuing (agree to two terms of service). My jQuery is fairly straightforward, you have to have both check boxes checked to continue:

$("#agree1, #agree2").click(function () {
    if ($("#agree1").is(':checked') == true &amp;&amp; $("#agree2").is(':checked') == true) {
        $("#nextPage").removeAttr("disabled");
    } else {
        $("#nextPage").attr("disabled", "disabled");
    }
});


I'm wondering if there is a simpler way of writing this. I expected a line like this to check for both boxes to be checked, but it doesn't:

if ($("#agree1 #agree2").is(':checked') == true)


Is there a way to simplify this?

Example code: jsFiddle
You can look for only the checked checkboxes, and then check that you found two:

if ($("#agree1:checked,#agree2:checked").length == 2) { ... }