Show hide div based on radio group value

Show hide div based on radio group value

Please someone tell me how to get this working  to show/hide div based on radio group value on page load and if changed

<script>
$(function () {

        if ($('input[name=assumptions]').val() == 1) {
            $('.assumptions-row').show();

        } else  {
            $('.assumptions-row').hide();
        }
});
    </script>

    <form>
        <p>
            <label>
                <input type="radio" name="assumptions" value="1" id="assumptions1">
                1</label>
            <br>
            <label>
                <input type="radio" name="assumptions" value="2" id="assumptions2">
                2</label>
            <br>
        </p>
    </form>
    <div class="assumptions-row">assumptions ......</div>