I'm writing a piece of HTML and JavaScript code, and I need to check if inputs have been filled before loading button after click on it. However, when I leave them blank, it proceeds to the PHP page passing the variables empty.
What I need is to add validation the forms to this code before loading button & disabled.
$(document).ready(function() {
$("#btnFetch").click(function() {
// disable button
$(this).prop("disabled", true);
// add spinner to button
$(this).html(
'<i class="fa fa-circle-o-notch fa-spin"></i> loading...'
);
});
});