Fill in second input when typing in the first

-3

I have an html form with SOCIAL REASON and FANTASY NAME, so I wanted it when I typed in the "Social Reason" field the "Fantasia Name" field was automatically filled with the same value. Thank you in advance for the help.

    
asked by anonymous 02.09.2018 / 04:07

2 answers

2

You can do this with jquery using something like this:

$(document).on('keyup', '#razao-social', function() {
    $('#nome-fantasia').val($(this).val());
});
    
02.09.2018 / 05:07
1
$(document).ready(function() {
    $('#ID_CONTROLE_RAZAO_SOCIAL').on('keyup', function() {
        $('#ID_CONTROLE_NOME_FANTASIA').val($(this).val());
    });
});

Place this code snippet in any Script tag, and preferably before the end of the Body tag, remembering to replace the IDs of the controls.

    
02.09.2018 / 17:06