How can I overwrite text in a file that is in textarea from a web page?

<textarea>какой-то текст</textarea> 

Closed due to the fact that the essence of the question is not clear to the participants 0xdb , LFC , entithat , freim , aleksandr barakin 12 Apr at 13:39 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    Form a distinct task. You can rewrite many ways - InDevX

2 answers 2

 function changeText() { document.getElementsByTagName("textarea")[0].value = "Another Text"; } 
 <textarea>Text</textarea> <button onclick="changeText()">Change text</button> 

    Using js

    If you contact by ID then:

     document.getElementById('myTextareaId').value = "MyText"; 

    If by class then:

     document.getElementByClassName('myTextareaClass').value = "MyText"; 

    Where MyTextareaClass / myTextareaId is the identifier of the text field and MyText is the desired text.

    • one
      getElementByClass - there is no such function; there is getElementsByClassName - Stanislav Grot