Javascript examples for DOM HTML Element:Input Checkbox
Input Checkbox value Property - Change the value associated with the checkbox:
<!DOCTYPE html> <html> <body> A Checkbox: <input type="checkbox" id="myCheck" value="myvalue"> <button onclick="display()">Display name</button> <button onclick="change()">Change name</button> <script> function display() { var x = document.getElementById("myCheck").value; console.log("The value of the checkbox is: " + x); } function change() {//from w w w . jav a2 s . c o m var x = document.getElementById("myCheck").value = "newCheckboxValue"; console.log("The value was changed to: " + x); } </script> </body> </html>