Chrome Extension - custom emote picker

I am working on a Chrome extension that adds custom emotes to the chat.

I added emote-menu and it successfully adds img’s alt value into the text area but clicking on “Chat” button does not send the message into the chat unless i manually add at least one character of my own inside text area.

Is there an event that i should trigger to make it work like a spacebar keypress?
I tried both .value and .innerHTML

Here is what i use.

var chatInput = document.querySelector('textarea[data-a-target="chat-input"]'); // Text area
var chatSend = document.querySelector('button[data-a-target="chat-send-button"]'); // "Chat" button

emoteList.addEventListener('click', function(e){
    if(e.target.nodeName == 'IMG'){
        chatInput.value += e.target.alt + '  ';
        chatSend.click(); //Clicks the button to instantly send text inside text area
    }
})

I’m developing a chrome extension that sends a message every a specific period of time
and I’m using nearly the same code and I’ve got the same problem I hope you found out how to solve it if you did please share it with me

I’m also working on a Chrome extension and having issues with setting the value of the chat input <textarea> programatically. With the below approach, I can briefly see a value change, but then it disappears (likely a controlled component). I’ve tried sending some KeyboardEvent after changing the value, but haven’t had any luck. Any ideas?

let chatInput = document.querySelector('.chat-input .tw-textarea');
chatInput.value = chatInput.value + ' testing...';

Matchbook necroed this thread and started their own here

Everyone seems to be creating new duplicate threads. To try and explain the issue some of you are having, it’s because you are changing the value of an input by just manipulating it in the DOM which doesn’t change the state of the component, or Redux store for the component using that. So if you want to do it properly you should read up on React.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.