Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
136
rated 0 times [  142] [ 6]  / answers: 1 / hits: 19872  / 11 Years ago, fri, march 8, 2013, 12:00:00

Let's say we have this markup:



<!DOCTYPE html>
<html>
<head>
<meta charset=utf8 />
<title>project.js</title>
<script src=project.js></script>
<script>

</script>
</head>

<body>
<h1>some project &mdash; javascript & html tests</h1>
<hr />

<p>
testing 123
</p>
</body>
</html>


I know that there are .prependChild(), .appendChild(), .innerHTML, etc, properties and methods, but what I am looking for is how to add (append) contents after the </body> tag closure?



I need this, without using jQuery — is it possible?


More From » prepend

 Answers
19

If you use 'id'.you can use these property:



document.getElementById('id').nextSibling; 
document.getElementById('id').previousSibling;

[#79739] Thursday, March 7, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
karivictoriab

Total Points: 530
Total Questions: 90
Total Answers: 95

Location: Honduras
Member since Sun, Dec 26, 2021
2 Years ago
;