You stop propagation (cancel bubbling) of the click:
$('#'+groupId)[0].addEventListener("click", function(e) {
e.stopPropagation();
collapseExpand(e); // You can omit the `e` if the function doesn't need it
});
By doing this within the child's event handler, you prevent the parent element from seeing the click.
Side note: You appear to be half-using jQuery. To fully use it:
$('#'+groupId).on("click", function(e) {
e.stopPropagation();
collapseExpand(e); // You can omit the `e` if the function doesn't need it
});