mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-16 05:39:24 +00:00
Deprecate the following obsolete functions and properties: * `keyman.helpURL` * `keyman.util.rgba` * `keyman.util.toFloat` * `keyman.util.toNumber` * `keyman.util.toNzString` Use correct language for code blocks in Keyman Engine for Web documentation. Test-bot: skip
43 lines
991 B
Markdown
43 lines
991 B
Markdown
---
|
|
title: attachDOMEvent
|
|
---
|
|
|
|
## Summary
|
|
|
|
Attach user-defined event handler for any DOM event for an element.
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
keyman.util.attachDOMEvent(Pelem, eventName, handler, useCapture);
|
|
```
|
|
|
|
### Parameters
|
|
|
|
`Pelem`
|
|
: Type: `Element`
|
|
: Element to which the event is being attached.
|
|
|
|
`eventName`
|
|
: Type: `string`
|
|
: The name of the event, without an 'on' prefix.
|
|
|
|
`handler`
|
|
: Type: `function(Object)`
|
|
: The event handler being attached.
|
|
|
|
`useCapture`
|
|
: Type: `boolean` *optional*
|
|
: Set this to `true` if the event should be captured in the bubbling phase; otherwise, use `false` or leave this parameter empty.
|
|
|
|
### Return Value
|
|
|
|
`undefined`
|
|
|
|
## Description
|
|
|
|
The event name should be specified without the 'on' prefix. The fourth argument, useCapture, is optional and will default to false.
|
|
|
|
The method exists for legacy reasons that arise when dealing with old versions of IE, simplifying event-handling code.
|
|
|
|
See also: [`keyman.util.detachDOMEvent`](detachDOMEvent)
|