Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <script>
  2. $(function() {
  3. $("#test_form").find("#submit_button").click(function(){
  4. if ($.trim($("#test_form").find("#first_name").val()).length == 0 || $.trim($("#test_form").find("#last_name").val()).length == 0){
  5. alert("Incorrect format!");
  6. } else {
  7. $('#test_form').submit();
  8. }
  9. });
  10. });
  11. </script>
  12.  
  13. <form id="test_form" action="/page.php">
  14. First name:<br>
  15. <input type="text" id="first_name"><br>
  16. Last name:<br>
  17. <input type="text" id="last_name"><br><br>
  18. <input type="button" id="submit_button" value="Submit">
  19. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement