Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2.  
  3. <html>
  4. <head>
  5.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6.     <title>Test</title>
  7.  
  8.     <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
  9.  
  10. </head>
  11. <body>
  12.  
  13.     <form>
  14.         <div class="form-group">
  15.             <label for="input1">Input</label>
  16.             <input type="text" class="form-control" id="input1" placeholder="">
  17.         </div>
  18.     </form>
  19.  
  20.     <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
  21.     <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
  22.  
  23.     <script>
  24.         $(document).ready(function(){
  25.  
  26.             var requested = false;
  27.  
  28.             $('#input1').on('keyup',function(){
  29.                 var count = $(this).val().replace(/\s/g, '').length;
  30.                 if (requested && count < 6) {
  31.                     requested = false;
  32.                 }
  33.                 if (count == 6 && !requested) {
  34.                     requested = true;
  35.                     console.log("Request");
  36.                 }
  37.             });
  38.         });
  39.     </script>
  40.  
  41. </body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement