troubleshooting Question

Check if a checkbox is clicked

Avatar of thaburner
thaburnerFlag for United States of America asked on
JavaScript
4 Comments1 Solution504 ViewsLast Modified:
I'm trying to setup so when checkbox is true it copies values from one to another and that works when not using the if statement i have below. Then when it is unchecked i want it to be empty fields for the most part i think i have it right but its not doing anything.

<script language="JavaScript">
<!--
function CopyText(){
if(RMARequest.shiptosameasbillto.checked){
    document.RMARequest.CompanyInfo_Ship_CompanyName.value = document.RMARequest.CompanyInfo_Bill_CompanyName.value
   
}else      
    document.RMARequest.CompanyInfo_Ship_CompanyName.value = ""
}
//-->
</script>

<input type="checkbox" name="shiptosameasbillto" id="shiptosameasbillto" onclick="CopyText()">Same as Bill To
ASKER CERTIFIED SOLUTION
Zvonko
Systems architect
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros