Hello! Explain, please.

There is a textarea . You need it when you click on the button to fill in the text. How to do it? What is the function?

html:

 <textarea id="input" rows="3" style="width: 100%"></textarea> <button onClick="try_func()">Button!</button> 

js:

 var text = "data"; function try_func() { //??? } 

I'm a newbie. Tell me please.

    1 answer 1

     <script> function try_func() { var area = document.getElementById('input');// получаем элемент с id input area.value = "data"; // заносим текст в элемент } </script> <textarea id="input" rows="3" style="width: 100%"></textarea> <button onClick="try_func()">Button!</button>