How to set text to div input/textarea in JavaScript?

Viewed 31

I'm trying to set/add a text content to a div element that is a React.js generated component and doesn't have value attribute on it.

For example, I'm working on set a text content on a tweet on Twitter, the HTML part is like e.g.:

<div aria-label="Tweet text" aria-multiline="true" data-testid="tweetTextarea_0" role="textbox">
  <span data-text="true">Hello everyone, this is my first tweet.</span>
</div>

A JavaScript code like document.querySelector('div[aria-label="Tweet text"]').value = "Hello everyone, this is my second tweet." doesn't work as I could expect.

So what can we do to set a text/value to a React.js (or Vue.js or such) input div?

0 Answers
Related