hitwill
hitwill

Reputation: 623

Send text to twitch.tv chat box with jquery

I am trying to send text to the twitch chat box through the console. I am targeting the text area with jquery but can also do pure js.

I have tried the following:

    $(`textarea[autocomplete='twitch-chat']`).text('test');

And some other variations. When I inspect the text element, its text is test. But the value is not showing up visually, and is also not sent when I press ENTER.

What is preventing the text from showing up visually, and also sending? And how can I achieve this?

I have also tried stuff like:

$(`textarea[autocomplete='twitch-chat']`).trigger($.Event("keydown", {keyCode: 70}));

Upvotes: 0

Views: 871

Answers (1)

P. Frank
P. Frank

Reputation: 5745

You dont need to use trigger or other. Just use val operator.

This working fine

$(`textarea[autocomplete='twitch-chat']`).val('test');

Upvotes: 1

Related Questions