append div just above span code example Example: appendBefore let insertedNode = parentNode.insertBefore(newNode, referenceNode)