Registers an event listener for the button.
Method of Button
Syntax
addEventListener( eventType, listener )
Parameters
Parameter | Description |
---|---|
eventType | A string representing the type of event after which the listener function will be executed. |
Description
This method adds an event listener that executes when a form control event of a particular type is fired. The fired event may be accessed within the event listener by having the listener accept the event as a parameter. When an event is fired, the listener function will be executed and this parameter will be set to reference an Event object.
Examples
Assume that a button with "Print" as the ID has been added to a Virtual Ticket job form. The following example illustrates the use of addEventListener to ensure that this print button prints the displayed record using the appropriate printing form:
See also
Form, Event, Form.getControlById, Button.removeEventListener