Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GoodBoyNinja/41346c112d9b359fe3f31a1e312acaa3 to your computer and use it in GitHub Desktop.
Save GoodBoyNinja/41346c112d9b359fe3f31a1e312acaa3 to your computer and use it in GitHub Desktop.
You can remove all the children of a group or a panel in a scriptUI panel using this function. Just pass that object to the function call
function RemoveAllChildrenFromPanel (panelObj) {
var panelObj = panelObj || undefined;
if (!panelObj || !panelObj.children || !panelObj.children.length) {
// no panel, or no children found
return;
}
for (var i = panelObj.children.length - 1; i >= 0; i--) {
var crntChildren = panelObj.children[i];
if (!crntChildren) {
continue;
}
try {
panelObj.remove(crntChildren);
} catch (e) {
// something went wrong with removing this children, you can print or alert an error here
continue;
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment