Create one event that checks for onload AND change
<p>I have this code that I want to a) run when the check box is checked. b) run on page load to see it needs to expand the section that is hidden by default.</p>

<pre><code>$(document).ready(function () {
    $('#hasContractorFlag').on('change', function () {
        if ($(this).is(':checked')) {
            $('#hasContractor').show();
        } else {
            $('#hasContractor').hide();
        }
    });
});
</code></pre>

<p>I tried adding the <code>load</code> event to the above and it wasn't being triggered.</p>

<p>I know I could do something similar to this and it would work:</p>

<pre><code>$(document).ready(function () {
    noAddress($('#hasContractorFlag'))

    $('#hasContractorFlag').on('change', function () {
        noAddress($(this));
    });

    function noAddress(var field) {
        if ($(field).is(':checked')) {
            $('#hasContractor').show();
        } else {
            $('#hasContractor').hide();
        }
    };
});
</code></pre>

<p>What is the best approach to accomplish this?</p>
