It happens that in my page I am adding several elements to the DOM dynamically, using the one .append()
from jquery , but in a div I have an element that I would like to know first if it exists or not, since if I give it an .append()
element again it would be added again.
It occurred to me to always do a .remove()
before .append()
to remove any instances of the object that were previously added. If it works for me, but I imagine there are other better ways to do it?