Javascript examples for DOM HTML Element:Input Checkbox
Input Checkbox value Property - Submitting a form, how to change the value associated with the checkbox:
<!DOCTYPE html> <html> <body> <form action="#"> <input type="checkbox" id="myCheck" name="vehicle" value="Happy" checked>How are you today<br> <input type="submit" value="Submit"> </form>//from ww w .jav a2 s . co m <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myCheck").value = "newCheckboxValue"; document.getElementById("demo").innerHTML = "attribute was changed."; } </script> </body> </html>