If Checkbox Checked Show Div

If at least one checkbox is checked show div. If none checked, hide div.

HTML

<form>
    <input type="checkbox" class="checkbox" name="checkbox" value="" />
    <br/>
    <input type="checkbox" class="checkbox" name="checkbox" value="" />
    <br/>
</form>
<div id="buttons">
    <p>This is the toolbar.</p>
</div>

JavaScript

var countChecked = function () {
    var n = $("input:checked").length;
    if (n >= 1) {
        $("buttons").css({
            "visibility": "visible"
        });
    } else {
        $("buttons").css({
            "visibility": "hidden"
        });
    }
};
countChecked();

$("input[type=checkbox]").on("click", countChecked);