Section 25.178. Input.onchange: event handler invoked when a form element s value changes


25.178. Input.onchange: event handler invoked when a form element's value changes

DOM Level 2 Events

25.178.1. Synopsis

 Function onchange 

25.178.2. Description

The onchange property of an Input object specifies an event-handler function that is invoked when the user changes the value displayed by a form element. Such a change may be an edit to the text displayed in input elements of type "text", "password", and "file", or the selection or deselection of a toggle button of type "radio" or "checkbox". (Radio and checkbox elements always trigger the onclick handler and may also trigger the onchange handler.) Note that this event handler is invoked only when the user makes such a change; it is not invoked if a JavaScript program changes the value displayed by an element.

Also note that the onchange handler is not invoked every time the user enters or deletes a character in a text-entry form element. onchange is not intended for that type of character-by-character event handling; instead, onchange is invoked when the user's edit is complete. The browser assumes that the edit is complete when keyboard focus is moved from the current element to some other elementfor example, when the user clicks on the next element in the form. See HTMLElement.onkeypress for character-by-character event notification.

The onchange event handler is not used by input elements of type "button", "hidden", "image", "reset", and "submit". Elements of those types use the onclick handler instead.

25.178.3. See Also

Element.addEventListener( ), HTMLElement.onkeypress; Chapter 17




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net