I have one jQuery form in which I am disabling the submit of form till the jQuery is initialized.
Code looks something like this
<form id="loginForm" role="form" class="form-horizontal col-md-8" action="">
<input type="email"/>
<input type="password"/>
<input type="submit" class="disabled">
</form>
(code is bit simplified.) Notice class 'disabled'
On jQuery side, I'm doing this
$().ready(function() {
$("#loginBtn").removeClass("disabled"); // This ensures that javascript was loaded before button is pushable
});
The problem is when the page is loading button is disabled and user is not allowed to click on it. But when button is disabled and user fills up the form and press enter. The form is getting submitted.
I want to stall submission of form (via any means) till the jQuery is properly loaded.
How can I achieve this?