I want to write a Chrome extension that adds a button to the corner of every textarea
element and shows an alert after a click on it. So I checked some alike extensions like Grammarly, and I noticed that it doesn't create any element on a page. So my question is: how can I write something like this?
I tried to do this by adding some button in the content.js
that unfortunately adds the element to the page and shows up in inspect mode.
content.js:
const btn = document.createElement('button')
btn.textContent = "Okay"
btn.onclick = function() { alert('blah'); };
document.documentElement.append(btn)
Example of what I want: