02/08/2012, 08:35 AM
I was just doing a little messing around with javascript and I got onto the topic of inserting nodes into the DOM. Basically, I used appendChild on the body element, appending a p element. Thing is, when you view the source of the page, the source page doesn't register that a p element was added to the page, yet you can clearly see a paragraph element on the display page. Why is that? It's confusing since you can't tell if your element was successfully added or not.
I'm guessing that it has something to do with the page being loaded first and the script being second.
Here's the code/page
I'm guessing that it has something to do with the page being loaded first and the script being second.
Here's the code/page
Code:
|