I have a chrome extension for personal use to change certain websites I visit. One site has a <textarea>
which you can type in. There is no submit button. You must press enter for what you typed to be submitted. There are no form tags anywhere either.
<div id="chatRoot">
<div data-reactroot="" class="chat-box-wrap_20_R_" style="min-width: 1180px;">
<div class="chat-box_Wjbn9 faction_2T9gm chat-active_1Sufk">
<div class="chat-box-input_1SBQR ">
<div>
<textarea name="chatbox" maxlength="840" class="chat-box-textarea_2V28W">
</textarea>
</div>
</div>
</div>
<!-- react-empty: 216 -->
</div>
</div>
I have tried creating a keyboard event and dispatching that with the enter key code, and while I believe it worked, it was rejected as an 'untrusted keypress.'
How do I submit data to a textarea
that has no form tags, no submit buttons, which only accepts the ENTER button as a valid form of submission, using vanilla javascript?
*I do not want to have to push the enter button. I want my chrome extension to automatically input data into the textarea
(which I have no problems with), and then have my chrome extension automatically submit the data it inputted (which is where my problem lies).
Thank you.