0

I am trying to build a Chrome extension that generates texts on Twitter. I am struggling with injecting the text in the inputfield.

Here is how I do it:

  • If the user has already input some content, it works great
  • If the user has not already input content, I have to slightly change the HTML (remove the default <br> and add a <span>)

However, on the second use case, it just doesn't work. The placeholder stays visible and the inputfied is broken.

See it in action: => https://www.loom.com/share/4bac993ba2cd4ee4a38fc209e751e323

(images if you don't want to check the video) enter image description here

enter image description here

Am I missing something? Is there some kind of JS variable on change in addition to changes in the HTML?

Thanks

user3885760
  • 53
  • 1
  • 5
  • Try document.execCommand, [example](https://stackoverflow.com/a/42101620). – wOxxOm Feb 09 '21 at 17:42
  • Thanks it almost works! Perfectly works if you have already input something in the Twitter's tweet area. If not, it breaks it. It's like the textarea is not "activated" – user3885760 Feb 09 '21 at 21:27

0 Answers0