How would i simply remove and and add a div in realtime? and yest I already have the div made manually on the page so it will be there to be removed even the first time the function is ran. The div is called 'testElem'
I'm trying:
var remDiv = document.getElementById('testElem');
document.body.removeChild(remDiv);
var divTag = document.createElement("div");
divTag.id = "testElem";
document.body.appendChild(divTag);
but the script isn't working. I tried placing an "alert" to test after the first remDiv. But its not even making it past there. The code breaks. In chrome i tried going to tools>Javascript console, but there are no errors. Is there a better way to debug javascript so I can see what the error is?
I'm just trying to do this so it will delete the content thats in the div every time the function is ran so the content doesn't double up. It's different every time.