Advertisement
lessientelrunya

form2

Jul 20th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.73 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4.     <head>
  5.         <script src="https://code.jquery.com/jquery-latest.min.js"></script>
  6.         <script>
  7.  
  8.             $(document).ready(function() {
  9.  
  10.                 $('#registration').submit(function() {
  11.  
  12.                     if ($('#registration input[name=email]').val() == '')
  13.                     {
  14.                         alert('missing email');
  15.                         return false;
  16.                     }
  17.                     else if ($('#registration input[name=password]').val() == '')
  18.                     {
  19.                         alert('missing password');
  20.                         return false;
  21.                     }
  22.                     else if ($('#registration input[name=password]').val() != $('#registration input[name=confirmation]').val())
  23.                     {
  24.                         alert('passwords don\'t match');
  25.                         return false;
  26.                     }
  27.                     else if (!$('#registration input[name=agreement]').is(':checked'))
  28.                     {
  29.                         alert('checkbox unchecked');
  30.                         return false;
  31.                     }
  32.                     return true;
  33.  
  34.                 });
  35.  
  36.             });
  37.  
  38.         </script>
  39.         <title>form2</title>
  40.     </head>
  41.     <body>
  42.         <form action="/register" id="registration" method="get">
  43.             <input name="email" placeholder="Email" type="text"/>
  44.             <input name="password" placeholder="Password" type="password"/>
  45.             <input name="confirmation" placeholder="Password (again)" type="password"/>
  46.             <input name="agreement" type="checkbox"/> I agree
  47.             <input type="submit" value="Register"/>
  48.         </form>
  49.     </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement