I have an issue where I need to set the value for checkboxes so that if the box is checked I pass a certain value and if the box is left unchecked i also pass a value.
Right now the code I have written is working fine if the box is checked. I am not getting anything to pass when the box is unchecked.
Here is the javascript i have written.
Here is the code for my checkbox
Right now the code I have written is working fine if the box is checked. I am not getting anything to pass when the box is unchecked.
Here is the javascript i have written.
Code:
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
const checkbox = document.getElementById("WEEK1")
checkbox.addEventListener('click', (event) => {
if (event.currentTarget.checked) {
document.getElementById("WEEK1").value = "Its ON";
} else {
document.getElementById("WEEK1").value = "Its OFF";
}
})
</SCRIPT>
Here is the code for my checkbox
Code:
response.write("<TD>")
Response.Write("<INPUT type=checkbox id=WEEK1 name=" & idPOS & ">")
response.write("</TD>")
Comment