I have a form which is accepting 2 fields and filling each field is compulsory. I have used the required attribute to achive this .
Enter A:<input type="text" name="a" required><br>
Enter B:<input type="text" name="b" required><br>
<button type="submit" class="sub" value="submit">
The parameter required save the line of codes to check the blank values and when without filling the value anyone clicks on the submit button it shows please fill out this field.
but I want to disable the submit button as soon as the form gets submitted.
I am using jquery for that
$('.sub').click(function(){
$('.sub').prop('disabled', true);
$('#dvLoading').show();
});
but the problem is even when the fields are not filled and on click of the submit button the button gets disables.
What can be done in that case so that the button only gets disabled when each fields are filled and form is getting submitted.