Auto populate field base on what was entered in another field simultaneously

前端 未结 4 1894
遇见更好的自我
遇见更好的自我 2021-02-10 04:21

I was trying to figure out how to auto-populate the input value base on what was entered in another input field using javascript. Here\'s my code:



        
4条回答
  •  -上瘾入骨i
    2021-02-10 04:25

    I made a general example :

    HTML

    
    
    

    javascript

    $(".first").on('keyup',function(){
        $(".second").val($(this).val());
    });
    

    http://jsfiddle.net/fmdwv/1/

    For your purpose :

    $("#address").on('change', function(){
      $("#shipping-address-1").val($(this).val());
    });
    

提交回复
热议问题