Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
The initTextEventEvent() method of the TextEvent interface initializes the value of a TextEvent after it has been created.
This method must be called to set the event before it is dispatched, using EventTarget.dispatchEvent().
Note: In general, you won't create these events yourself; they are created by the browser.
initTextEvent(type) initTextEvent(type, bubbles) initTextEvent(type, bubbles, cancelable) initTextEvent(type, bubbles, cancelable, view) initTextEvent(type, bubbles, cancelable, view, data)
typeA string to set the event's type to. There is only one event type for a TextEvent: textInput.
bubbles OptionalA boolean indicating whether or not the event can bubble. false by default. Sets the value of Event.bubbles.
cancelable OptionalA boolean indicating whether or not the event's default action can be prevented. false by default. Sets the value of Event.cancelable.
view OptionalThe WindowProxy object from which the event was generated. null by default.
data OptionalA string to set event's data attribute.
None (undefined).
| Specification |
|---|
| UI Events> # dom-textevent-inittextevent> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
initTextEvent |
1 | 12 | 129 | 15 | 3 | 18 | 129 | 14 | 2 | 1.0 | 4.4 | 2 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/TextEvent/initTextEvent