I have the following view, my question is to implement a jquery alert blocking message without using the usual js alertBox
Html form
<form name="userLogin" action="success.php" onsubmit="validateInputField()" method="post"> UserName: <input type="text" name="username" placeholder="Username"> password: <input type="password" name="pwd" placeholder="Password"> <input type="submit" value="Submit"> </form>
javaScript code
<script> function validateInputField() { var x = document.forms["userLogin"]["username"].value; var y = document.forms["userLogin"]["pwd"].value; if (x == null || x == "") { alert("Name must be filled out"); return false; } if (y == null || y == "") { alert("Password must be filled out"); return false; } } </script>
source share