how to add p in div first child code example Example: append element in a div as first child ParentNode.insertBefore(<your element>, ParentNode.firstChild);