before
This method can be used to insert an element or HTML string before each element in the collection.
// Insert an element before the elements
before: function(element) {
this.elements.forEach(function(el) {
el.parentNode.insertBefore(element, el);
});
return this;
},
// Insert an HTML string before the elements
before: function(html) {
this.elements.forEach(function(el) {
el.insertAdjacentHTML("beforebegin", html);
});
return this;
}