Home > Blockchain >  I keep getting [object HTMLTextAreaElement] as a response from JavaScript
I keep getting [object HTMLTextAreaElement] as a response from JavaScript

Time:09-30

I can't figure out what the issue is. Even the already existing question about this doesn't help.

document.getElementById("output").value = codeDecoded

The HTML is:

<h3>Input</h3>
<textarea placeholder="Input..." id="input"></textarea>
<h3>Output</h3>
<textarea id="output" placeholder="Output..." readonly></textarea>
<br>
<button onclick="decode(document.getElementById('input'))" >Decode</button>

CodePudding user response:

document.getElementById("input") returns the <textarea> element itself, rather than its value. To receive the actual text, you need onclick="decode(document.getElementById('input').value)"

  • Related