InputEvent data Property
Example
Return the input data from a text field:
function myFunction(event) {
let text = event.data;
}
Try it Yourself »
Description
The data
property returns the inserted character(s) from an input event.
The data
property returns null
if characters are deleted.
The data
property is read-only.
Syntax
event.data
Technical Details
Return Value: |
A String. The character(s) that was inserted |
---|
Browser Support
event.data
is a DOM Level 4 (2015) feature.
It is supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes |
event.data
is not supported in Internet Explorer 11 (or earlier).