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