The inputType property is used to know the type of change that is made to a particular input field or any other editable content by the event. It is a read-only property.
Syntax:
event.inputType
Return Value: It returns a string that indicates the type of input entered.
Example: In this example, we will use the inputType property
HTML
<!DOCTYPE html>
< html >
< head >
< title >DOM InputEvent inputType Property</ title >
</ head >
< body style = "text-align:center" >
< h1 style = "color: green;" >
GeeksforGeeks
</ h1 >
< h2 >DOM InputEvent inputType Property</ h2 >
< textarea rows = "2" id = "myInput" oninput = "Geeks(event)" >
</ textarea >
< p >Input Type: < span id = "p" ></ span ></ p >
< script >
function Geeks(event) {
document.getElementById("p").innerHTML =
event.inputType;
}
</ script >
</ body >
</ html >
|
Output:
Supported Browsers: The browser supported by inputType Property are listed below:
- Apple Safari
- Google Chrome 60.0
- Firefox Not supported
- Opera 47.0
- Internet Explorer Not supported