pixel-editor/js/util/onClickChildren.js

13 lines
422 B
JavaScript
Raw Normal View History

2019-03-27 02:20:54 +03:00
//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);
}
}