JSFiddle - React, Tailwind, and code Playground
HTML
Account Form
<input type="checkbox" id="checkbox1" />
</br>
<!-- account form fields -->
Name <input type="text" id="name" /> </br>
Phone <input type="text" id="phone" /></br></br>
Billing Form
<!-- billing form fields-->
Billing Name <input type="text" id="name_billing" />
Billing Form <input type="text" id="phone_billing" />
JavaScript
$(document).ready(function(){
$("#checkbox1").change(function() {
if(this.checked) {
alert("checked ");
//get the values of the filled fields
$name = $("#name").val();
$phone = $("#phone").val();
console.log("name");
// then add those values to your billing infor window feilds
$("#name_billing").val($name);
$("#phone_billing").val($phone);
// then form will be automatically filled ..
}
else{
$('#name_billing').val('');
$("#phone_billing").val('');
}
});
});