0

I'm working on a page that have a lateral panel, this panel is part of an external app so elements on this panel doesn't exist until the panel is opened, but based on a condition I need to hide some tabs of the panel, however the external app doesn't have a way to receive a boolean and just hide those tabs, thats why I thought of hide them by text, but since they doesn't exist when opening the panel, the method doesn't work, I try with answer but since I need to select the item by text it doesn't work for me. This project uses react, but I need to do this using plain javascript

How to wait until an element exists?

Andree
  • 39
  • 4
  • You might hide those elements with CSS `display:none` if there are specific selectors for them, like `:nth-child()`. If you need to hook into the DOM changes, this is what [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) designed for. – Jared Oct 27 '22 at 21:28

0 Answers0