Name

Select.onchange: event handler invoked when the selection changes — DOM Level 0

Synopsis

Function onchange

Description

The onchange property of a Select object refers to an event-handler function that is invoked when the user selects or deselects an option. The event does not specify what the new selected option or options are; you must consult the selectedIndex property of the Select object or the selected property of the various Option objects to determine this.

See Element.addEventListener( ) for another way to register event handlers.

See Also

Element.addEventListener( ), Option; Chapter 17

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.