JSFiddle - React, Tailwind, and code Playground

by Rejith R Krishnan

HTML

<input type="text" id="address1" value="" />
<input type="checkbox" id="copyAddress" />
<input type="text" id="address2" value="" />

JavaScript

$('#copyAddress').click(function () {
    if ($(this).prop('checked')) {
        $('#address2').val($('#address1').val());
    } else {
        $('#address2').val('');
    }
});