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?