1

I am trying to set default value to an input from another I am entering. However, I can enter data into that box. But I cannot get new value I entered when I submit. Please see my code below:

$('.input1').bind('keyup blur', function(){
    $('.input2').val($(this).val());
});
lyhong
  • 947
  • 1
  • 13
  • 23

1 Answers1

3

Use on("input", function () { ... }), instead:

$('.input1').on('input', function(){
    $('.input2').val($(this).val());
});

JSFIDDLE


Also, see this thread about the difference between input and change.

Community
  • 1
  • 1
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474