alright, I have made a function to clear two text boxes on the click of a button. For some reason that I dont know it isnt working. Code is pasted below -
function clear() {
document.getElementById("IMEI").value = "";
document.getElementById("Command").value = "";
}
<!-- IMEI -->
<label><font color=#829DBA face="Tahoma"><b>IMEI:</b></font></label>
<input type="text" name="ID" id="IMEI" maxlength="15">
<!-- -->
<!-- AT Command -->
<label><font color=#829DBA face="Tahoma"><b>AT Command:</b></font></label>
<input id="Command" type="text">
<!-- -->
<!-- Clear Button -->
<button type="button" onclick="clear();">Clear</button>
<!-- -->
Thanks
It's a scoping issue with the word clear
, change the function name to cleared
and you will see it working correctly. You could also call the function with window.clear()
if you were unable to rename this function for some reason.