So my problem is that I have a HTML <textarea>
element and a button which should clear the textarea. But for some reason this does not work. What am I doing wrong?
function clear() {
document.getElementById('output').value = '';
}
<textarea spellcheck="false" rows="8" cols="80" id="output">Lorem Impsum</textarea>
<button onclick="clear()">Clear Output</button>