A saved reference of an element that does not exist (JS)

Hello, how can I bypass the reference of an element that no longer exists in the DOM structure?

My problem is that as a result of asynchronous addition of elements to a container that initially contains one element, this element is removed when the first element is added to the container, but its reference remains when using, for example, the children method.

if (element?.someSelectionMethod) {
  do thing
}

Where you need to do the thing.

You’ll need to provide some code, though, for advice that’s specific to what you’re trying to do

1 Like

The problem is already solved. :wink:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.