troubleshooting Question

Getting state of a checkbox

Avatar of dssisupport
dssisupport asked on
JavaScriptASP
5 Comments1 Solution378 ViewsLast Modified:
I am having a problem getting the checked state of a checkbox after an onclick event. I have verified that the onclick event triggers but no matter how I try and check the state of the element (by name or by id) I am not seeing anything coming back. Below is a copy of the function I am currently trying to use to get it by the element ID and also the checkbox html code. The form name is addeval, if that is relevant.

<script type="text/javascript">
function RefreshScore()
{
If(document.getElementById("Section1Question1NAValue").checked)
      {
       alert("N/A is checked");
       }      
Else
      {      
      alert("N/A is NOT checked");
      }
}
</script>


<input name="Section1Question1NAValue" id="Section1Question1NAValue" type="checkbox" onClick="RefreshScore()">&nbsp;<span class="auto-style8">N/A
</span>
ASKER CERTIFIED SOLUTION
viralpala

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 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 5 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