1

When I run

$("textarea").val("hello");

the events that Firefox developer tools (F12) reports are bound to this textarea,

,

are not triggered. How do I trigger them?

Running $("textarea").val("hello"):

Manually inputting text:

This textarea is on a website that has all sorts of code to prevent automated entry into the textarea. Even running a JavaScript or jQuery .click() on the textarea doesn't select it.

Appending .change(), as suggested by an answer to "val() doesn't trigger change() in jQuery", doesn't work for me, either.

Geremia
  • 4,745
  • 37
  • 43

1 Answers1

0

The issue is that events not bound with jQuery cannot be triggered with jQuery, so you will have to trigger the change event using JavaScript:

let element = document.getElementById(idOfTextArea);
element.dispatchEvent(new Event('change', { 'bubbles': true }));

source: this answer to "How to trigger event in JavaScript?"

Geremia
  • 4,745
  • 37
  • 43