How can I overwrite text in a file that is in textarea from a web page?
<textarea>какой-то текст</textarea> How can I overwrite text in a file that is in textarea from a web page?
<textarea>какой-то текст</textarea> 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 .
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.
getElementByClass - there is no such function; there is getElementsByClassName - Stanislav GrotSource: https://ru.stackoverflow.com/questions/968432/
All Articles