Hey. I'm looking for a solution that will create, fill and display a container in javascript directly beneath a specific element (no whitespace, margins w.e)

<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript"><!--
function insertAfter(parent, newNode, referenceNode)
	parent.insertBefore(newNode, referenceNode.nextSibling);
function addElement()
	var dad = document.getElementById('container');
	var elementAboveNew = document.getElementById('sib1');
	var newElement = document.createElement('div');
	newElement.innerHTML="Element " +window.dynamicNodeCount;
	insertAfter(dad,  newElement, elementAboveNew);
<div onclick="addElement();">Add Element</div>
<div id="container">
	<div id="sib1">a</div>
Hey thanks dude.
This article has been dead for over six months. Start a new discussion instead.