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());
});

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.