Prefill a form based on radio answer

Prefill a form based on radio answer

trying to write a code to prefill a form field based on a radio box answer

Example

Buyer First name
Buyer Last Name

Radio Box has Buyer and Co Buyer are Married

if Yes, would prefill the Co Buyer Last Name field with Buyer Last Name Data