Twice the nice, double up no mo'!

Duplicate input from one field to a second hidden field to avoid having the user filling in the same information twice.

by lennyekberg

HTML

Check console or make #autocopy_wrap visible to debug
<hr>

<span id="input_manual_wrap">Manual input
    <input id="input_manual" type="text"></input>
</span>

<span id="autocopy_wrap">Automatic copy
    <input id="input_autocopy"type="text"></input>
</span>

CSS

input{
    display:block;
    margin:0 0 12px 0;
    position : relative;
}

JavaScript

jQuery(document).ready(function(){
    console.log('double input ready');
    //only hide second input if javascript is available
    jQuery("#autocopy_wrap").hide();
    jQuery('#input_manual').on('keyup change paste', function(e){
        jQuery('#input_autocopy').val(jQuery(this).val())
        //debug to see if input is registered through second input field
		console.log(jQuery('#input_autocopy').val());
    });
});