I have a form.
When I exit the text field it should alert “HH” and submit the form – run a PHP script.
if I exit the text field, I get the alert but it is not submitted.
only pressing the submit button calls the PHP script.
what I’m doing wrong?
I found a few questions as my, tried the solution, but it not working.
<html>
<head>
<script src="vendor/jquery/jquery-3.2.1.min.js"></script>
<script>
$(document).ready(function(){
$("#faults_form input").blur(function(){
alert("HH");
$("#faults_form").submit();
return false;
});
});
</script>
</head>
<body>
<form id="faults_form" name="faults_form" action="/index.php" method="post" enctype="multipart/form-data">
<label for="name">Enter server name:</label>
<input type="text" name="name" value="" >
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>