HTML onchange Event Attribute HTML Reference


Check an input field when the value is changed:

<input type="text" name="txt" value="Hello" onchange="checkField(this.value)">

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

1. Definition and Usage

The onchange attribute fires the moment when the value of the element is changed.

The onchange attribute can be used with the <input>, <textarea>, and <select> elements.

2. Differences Between HTML 4.01 and HTML5


3. Syntax

<element onchange="script">

4. Attribute Values

Value Description
script The script to be run on onchange

Relative articles