skip to Main Content

I have a form for which has fields like card no ,card holders name,expiry date and stuff i want something like whenever i am filling the form it should be displayed side by side before storing it to database ,any help?

2

Answers


  1. Bind it to a jQuery keyup event

    <form>
      Card No:</br>
      <input type="number">
      <input type="submit" value="submit">
    </form>
    
    <p id="display">
    </p>
    
    <script>
    $(document).ready(function () {
    $(":number").keyup(function () { 
    $("#display").text($(":number").val());
    });
    });
    </script>
    
    Login or Signup to reply.
  2. Here is a really easy solution in vanilla js;

    let input = document.getElementById('in');
    input.onkeyup = () => {
    document.getElementById('p').innerHTML = input.value;
    }
    <input id='in' type='text'>
    
    <p id='p'></p>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search