I made a little script, which checks if a HTML form is filled. If not, it opens a alert message. But right after that message, it's still opening the php-file named in the action-attribute.. how to solve that?
<script>
$(document).ready(function() {
$("#landinglog").click(function() {
ValidateForm();
});
});
function ValidateForm() {
var formInvalid = false;
$('#loginForm input').each(function() {
if ($(this).val() === '') {
formInvalid = true;
}
});
if (formInvalid)
alert('One or Two fields are empty. Please fill up all fields');
location.reload();
}
The "location.reload" didn't solved it.