Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <script>
  2. function checkTimeFormat(time) {
  3. // Modify this to check for your RegEX
  4. if (time == "") return false;
  5. return true;
  6. }
  7.  
  8. function checkForm() {
  9. var time = $("#time").val();
  10. if (!checkTimeFormat(time)) {
  11. alert("Incorrect format for time!");
  12. return false;
  13. };
  14. }
  15. </script>
  16.  
  17. <form action="/page.php">
  18. Time:<br>
  19. <input type="text" id="time"><br>
  20. <input type="submit" value="submit" onClick="return checkForm();">
  21. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement