I am writing an application similar to that of a command prompt. It takes userCommand as input & writes the output to a txt id. Im wanting to have it clear the txt area when user submits command "Cls".
HTML:
<div class="Typewriter">
<txt id='output'></txt>
</div>
<input id='cmd' onfocus="clearThis()" size="25" style="font-size:14pt;"/>
<button onclick='text()'>Enter</button>
JS:
function clearThis(){
if(cmd.value='Cls')
document.getElementById('output').value='';
}
}
I have searched high & low but none of the scripts ive found seem to do anything & I cant figure it out. Any help would be much appreciated! TIA