Have a need to append span element to DOM.
if (check smth...) {
a = createElement('span');
a.id = '_span';
b = document.getElementById('container');
b.appendChild(a);
}
What is the best way to do in “if” to prevent duplicating same element from dom tree ? It is kinda – “open the window and don’t do it again until it were closed”
1 Answer