J
JehanNYNJ
I need to clear out the HTML contents of a <span> element and then
re-add that element as a blank span.
Here is the code...
var elem = document.getElementById(spanId);
var deletedElem = elem.parentNode.removeChild(elem);
deletedElem.innerHTML = '<span id="'+spanId+'"></span>';
deletedElem.parentNode.appendChild(deletedElem);
This does not work. When I try to getElementById the second time the
function is called it does not find the span I added. Any suggestions?
Thanks in advance for any help.
re-add that element as a blank span.
Here is the code...
var elem = document.getElementById(spanId);
var deletedElem = elem.parentNode.removeChild(elem);
deletedElem.innerHTML = '<span id="'+spanId+'"></span>';
deletedElem.parentNode.appendChild(deletedElem);
This does not work. When I try to getElementById the second time the
function is called it does not find the span I added. Any suggestions?
Thanks in advance for any help.