Get to know MDN better
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The TextUpdateEvent interface is a DOM event that represents a text or selection update in an editable text region that's attached to an EditContext instance.
This interface inherits properties from Event.
Event TextUpdateEventCreates a new TextUpdateEvent object.
Returns the index of the first character in the range of text that was updated.
TextUpdateEvent.updateRangeEnd Read onlyReturns the index of the last character in the range of text that was updated.
TextUpdateEvent.text Read onlyReturns the text that was inserted in the updated range.
TextUpdateEvent.selectionStart Read onlyReturns the index of the first character in the new selection range, after the update.
TextUpdateEvent.selectionEnd Read onlyReturns the index of the last character in the new selection range, after the update.
In the following example, the EditContext API is used to render editable text in a <canvas> element, and the textupdate event is used to render the text when the user is typing.
| EditContext API # dom-textupdateevent |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 26, 2024 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.