Form Fails to Submit After Disabling Button

I’m attempting to disable a submit button onclick to prevent the user from double-clicking and submitting the same data twice. Seems simple enough but once I add in my disable code (as seen below) the button successfully is disabled but the form fails to submit.

<button type="submit" class="btn" onclick="disableButtons();">Submit</button>
<script type="text/javascript">
    function disableButtons() {
        $(".btn").each(function () {
            $(this).attr("disabled", "disabled");
        });
    }
</script>

Any ideas what I’m doing wrong here?

Try this

function disableButtons() {
    $('.btn').each(function () {
        $(this).attr('disabled', 'disabled');
        $(this).parents('form').submit();
    });
}

Thank you kindly, Sir. Worked great!

You should probably use onsubmit, rather than onclick. Onclick is triggered any time the button is clicked, which doesn’t necessarily mean that the form will be submitted. Onsubmit, on the other hand, is triggered when the submit event actually occurs.