Check if all checkboxes are checked

by Alvin Olavarrieta

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<label class="checkbox-inline">
    <input type="checkbox" value=""> This information is correct
        </label>
    
    <label class="checkbox-inline">
    <input type="checkbox" value=""> This information is correct
        </label>
        
        <label class="checkbox-inline">
    <input type="checkbox" value=""> This information is correct
        </label>
            
            <label class="checkbox-inline">
    <input type="checkbox" value=""> This information is correct
        </label>
                
<a href="find-options.html" class="btn btn-default btn-lg disabled">Confirm</a>

JavaScript

var boxes = $("input[type='checkbox']").length;

            $("input[type='checkbox']").on("change", function () {

                if ($("input[type='checkbox']:checked").length == boxes) {
                    $(".btn").removeClass("disabled");
                } else {
                    $(".btn").addClass("disabled");
                }
            });