mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
first commit
This commit is contained in:
14
_ext/scripts/utilities/onChildren.js
Normal file
14
_ext/scripts/utilities/onChildren.js
Normal file
@ -0,0 +1,14 @@
|
||||
//add event listener to each of specified element's children
|
||||
|
||||
function onChildren(event, parentElement, functionCallback) {
|
||||
console.log('onChildren()');
|
||||
|
||||
var parentElement = (typeof parentElement == 'string' ? document.getElementById(parentElement) : parentElement);
|
||||
|
||||
var children = parentElement.children;
|
||||
|
||||
//loop through children and add onClick listener
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
on(event, children[i],functionCallback);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user