Latest web development tutorials

oninput event

Event Object Reference Event objects

Examples

JavaScript is executed when the user to <input> try to enter:

<Input type = "text" oninput = "myFunction ()">

try it"


Definition and Usage

oninput event is triggered when the user input.

The event is triggered when the value <input> or <textarea> element is changed.

Note: This event is similar to the onchange event. The difference is that in the event oninput element values ​​change is triggered immediately, onchange Fires when the element loses focus. Another thing different is onchange event to be acting on the <keygen> and <select> element.


Browser Support

Figures in the table represent the first browser to support this version of events.

event
oninput Yes 9.0 4.0 5.0 Yes


grammar

In HTML:

<Elementoninput = "myScript"> try

In JavaScript:

object .oninput = function () {myScript }; try

JavaScript, use the addEventListener () method:

object .addEventListener ( "input", myScript ); try

Note: Internet Explorer 8 and earlier versions of IE do not support addEventListener () method.


technical details

Whether to support the bubble: Yes
It can be canceled: No
Event Type: Event
Supported HTML tags: <Input type = "password">, <input type = "search">, <input type = "text"> and <textarea>


Event Object Reference Event objects