Copy text of a field into another automatically

后端 未结 8 1207
攒了一身酷
攒了一身酷 2020-12-16 08:32

I need to copy the text entered in a field (whether it was typed in, pasted or from browser auto-filler) and paste it in another field either at the same time or as soon as

8条回答
  •  Happy的楠姐
    2020-12-16 08:55

    Try something like:

    $(document).ready(function () {
        $('#field_1').on('change', function (e) {
           $('#field_2').val($('#field_1').val());
        });
    });
    

    Heres a fiddle: http://jsfiddle.net/otwk92gp/

提交回复
热议问题