79190334

Date: 2024-11-14 20:34:33
Score: 0.5
Natty:
Report link

As I wrote in this (possibly duplicate) question

The inputType event property is used to determine the kind of change that was performed, since the input event is triggered after the change has taken place.

Notice, it is not allowed to set the inputType as an event detail on a system event, but this work-around seems to work in my own tests.

    const inpType = "insertText";

    const evt = new Event('input', { bubbles: true, cancelable: true })
    evt.inputType = inpType;
    inputField.dispatchEvent(evt);

Please read this documentation (and try the sample within) on Mozilla.org

Here are the behaviors triggering the various inputType enums: w3c.org

Reasons:
  • Blacklisted phrase (1): this document
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Thomas Williams