Requesting guidance in store textarea in var, and return it

I’m starting to apply what I’ve learnt in the Basic JavaScript course, as title says I want to have a user type into an html textarea, store it into a var and return it back to him as simple as that, or for the least have the console display the var. I am rather stomp as how to get going though.

here is the sketch.

You can try the following code

<div id="input" >input calculation query </div>
<textarea  id="text" ></textarea>
<button onclick="handelclick()">=</button><br>
<div id="output" ></div>
   function handelclick(){
      var value= document.getElementById('text').value ;
     document.getElementById('output').innerHTML= "answer : "+value ;

Hi thank you for helping, doesn’t seem to run as I edited following code

Here is why it doesn’t work. First you need to include in your html page. Something is not up and running with JS viewbox down there.

<DOCTYPE html>


<div name="data-input">input calculation query </div>
<textarea id="input" rows="4" cols="10"></textarea>
<button onclick="report()">=</button><br>
<div id="output" name="data-output">answer:</div>

function report(){

1 Like

Thank you issue solved.