mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-27 00:48:41 +00:00
Adding event listener for array of elements
This commit is contained in:
parent
56757de774
commit
ba9c02bb03
|
|
@ -254,6 +254,27 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adding event listener to multiple elements
|
||||
*
|
||||
* @param e DOM Elements
|
||||
* @param {string} event Event name
|
||||
* @param {function} callback Event callback
|
||||
*
|
||||
* @function
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.addEventListenerToAll = function(e, event, callback)
|
||||
{
|
||||
let length = e.length;
|
||||
|
||||
for(let i = 0; i < length; i++) {
|
||||
e[i].addEventListener(event, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Merging two arrays recursively
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user