new function to get ids of parent elements