Add multiple native, custom, or X-Tag library event listeners to an element using one function.
xtag.addEvents(ELEMENT, OBJECT)
xtag.addEvents(ELEMENT, OBJECT)
Arguments | Type | Description |
---|---|---|
ELEMENT | DOM element reference | The element you would like to attach event listeners to. |
OBJECT | Object | An object composed of multiple events - keys are event names, and values are the event handlers. |
xtag.addEvents(myElement, {
'tap': function(event){
alert('myElement was just tapped ' + this);
},
'keypress': function(event){
alert('the following key was pressed on myElement' + e.keyCode);
}
});