In addition to John Answer. You can also use the syntax:
final el = query('#test'); // If you want an element el.insertAdjacentElement('beforebegin', new Element.tag('p')); // If you want to insert HTML tags el.insertAdjacentHTML('beforebegin', '<p>Hello</p>'); // Insert just text el.insertAdjacentText('beforebegin', 'Hello there');
You can use positional arguments: beforebegin, afterbegin, preend, afterend, which will place it before the beginning of another element, only inside the beginning of the element, only inside the end of the element or only outside the element, respectively.
source share