Question

I have a static content which I want to display if the user checks a checkbox and hide the content if the user unchecks the box.

1 Answers
<input id="toggleDisplay" type="checkbox"/>
<div id="content">Tick the checkbox to display the content. Uncheck the box to hide it.</div>

$(function() {
    function toggleCheckBox() {
        var isChecked = $('#toggleDisplay').is(':checked');
        var content = $('#content');
        if (isChecked) {
            content.show();
        } else {
            content.hide();
        }
    }
    $('#toggleDisplay').change(function() {
        toggleCheckBox();
    });
    toggleCheckBox();
});