Advertisement
Sebuahhobi98

regex

Mar 31st, 2019
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Regex</title>
  5. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  6. </head>
  7. <body>
  8. <div class="row" style="padding-left: 20px; padding-top: 20px; padding-right: 20px;">
  9. <div class="col">
  10. <div class="card">
  11. <div class="card-body">
  12. <input type="text" id="input" class="form-control">
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. <div class="row" style="padding-left: 20px; padding-top: 20px; padding-right: 20px;">
  18. <div class="col">
  19. <div class="card">
  20. <div class="card-body">
  21. <label><span>Jawaban</span></label>
  22. <input type="text" id="jwb" class="form-control" readonly="readonly">
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27.  
  28.  
  29.  
  30. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
  31. <script>
  32. $(document).ready(function(){
  33. $("#input").keyup(function () {
  34. var VAL = this.value;
  35.  
  36. if (VAL.match("[0-9$][1-9]{1}/[0-9]{1}[1-9]{1}$")) {
  37. $("#jwb").val("Karakter terpenuhi");
  38. }else{
  39. $("#jwb").val("Karakter tidak terpenuhi terpenuhi");
  40. }
  41. //console.log(VAL);
  42. });
  43. });
  44. </script>
  45. </body>
  46. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement