mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
14 lines
456 B
JavaScript
14 lines
456 B
JavaScript
//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);
|
|
}
|
|
} |