So I know that fields are properly named, but javascript is still not copying info over when the check box is checked. I have double checked and everything matches up in the fields.
JavaScript:
function FillShiping(f) {
if(f.shipingtoo.checked == true) {
f.shipto.value = f.billto.value;
f.shipaddress.value = f.Address.value;
f.shipcity.value = f.City.value;
f.shipstate.value = f.State.value;
f.shipzip.value = f.Zip.value;
}
if(f.shipingtoo.checked == false) {
f.shipto.value = '';
f.shipaddress.value = '';
f.shipcity.value = '';
f.shipstate.value = '';
f.shipzip.value = '';
}
}
HTML:
<div class="fb-checkbox">
<input type="checkbox" onclick="Fillshiping(this.form)" name="shipingtoo">
<span class="fb-fieldlabel" id="item61_0_span">Check this if shipping address is same
as billing address </span>
</label>
</div>
</div>
The console shows the error:
You named the function
FillShiping, but you are callingFillshiping(this.form)(lowercases).After correcting your fiddle and naming the function properly, it seems to work.
Use your browser’s developer tools to debug your code, it’s invaluable.