Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Regex</title>
- <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">
- </head>
- <body>
- <div class="row" style="padding-left: 20px; padding-top: 20px; padding-right: 20px;">
- <div class="col">
- <div class="card">
- <div class="card-body">
- <input type="text" id="input" class="form-control">
- </div>
- </div>
- </div>
- </div>
- <div class="row" style="padding-left: 20px; padding-top: 20px; padding-right: 20px;">
- <div class="col">
- <div class="card">
- <div class="card-body">
- <label><span>Jawaban</span></label>
- <input type="text" id="jwb" class="form-control" readonly="readonly">
- </div>
- </div>
- </div>
- </div>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
- <script>
- $(document).ready(function(){
- $("#input").keyup(function () {
- var VAL = this.value;
- if (VAL.match("[0-9$][1-9]{1}/[0-9]{1}[1-9]{1}$")) {
- $("#jwb").val("Karakter terpenuhi");
- }else{
- $("#jwb").val("Karakter tidak terpenuhi terpenuhi");
- }
- //console.log(VAL);
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement