How to link checkbox from HTML in java script? I set the checkbox in HMTL as follows:
<label><b>Response Needed ?</b></label>
<input id="Check" type="checkbox" >
When I click the submit button, I need the value to be T (true) or F (false) if it is checked or not.
I usually use getElementById("")to link things with Javascirpt, but I can't get it to work!
EDIT: Here is my complete document so you can see how it works:
`
<!DOCTYPE HTML>
<html>
<head lang="en">
<meta charset="UTF-8">
</head>
<body>
<form id="OTA">
<label><b>IMEI:</b></label>
<input type="text" name="ID" id="IMEI" maxlength="15">
<label><b>AT Command:</b></label>
<input id="Command" type="text">
<label><b>Response Needed ?</b></label>
<input id="Check" type="checkbox" >
</form>
<input type="submit" value="Submit" onclick="showInput();"><br />
<p><span id='display'></span> </p>
<script language="JavaScript">
function showInput() {
var message_entered = ">RSP=" + document.getElementById("Check").checked + ";ID=" + document.getElementById("IMEI").value + ";" + document.getElementById("Command").value + "<";
document.getElementById('display').innerHTML = message_entered;
}
</script>
</body>
</html>
I need to change the values of the T and F checkbox if they are set or not. Greetings
source
share