pixel-editor/_ext/scripts/utilities/onClickChildren.js
2019-03-26 23:20:54 +00:00

13 lines
422 B
JavaScript

//add click listener to each of specified element's children
function onClickChildren(parentElement, functionCallback) {
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++) {
onClick(children[i],functionCallback);
}
}