Hola.js DocumentationBlogBlogSupport UsSupport UsAboutAboutContact ↗Contact ↗ (opens in a new tab)
GitHubGitHub (opens in a new tab)
  • Hola.js Intro
  • Install Hola.js
  • Hello World
  • Event Methods
    • Blur(callback)
    • Change
    • Focus
    • Hover
    • Keydown
    • Keyup
    • Mousemove
    • Off
    • On
    • One
    • Submit
    • Trigger
  • Filtering Methods
    • Eq
    • Filter
  • Insertion Methods
    • After
    • Append
    • Before
    • Prepend
  • Selection and Manipulation Methods
    • Addclass
    • Attr
    • CSS
    • Hide
    • HTML
    • Removeattr
    • Removeclass
    • Show
    • Text
    • The $ Object
    • Toggleclass
  • Traversal Methods
    • Children
    • Find
    • Parent
    • Siblings
  • Hola.js Intro
  • Install Hola.js
  • Hello World
  • Blog
  • Support Us
  • About
  • Contact ↗ (opens in a new tab)
  • Event Methods
    • Blur(callback)
    • Change
    • Focus
    • Hover
    • Keydown
    • Keyup
    • Mousemove
    • Off
    • On
    • One
    • Submit
    • Trigger
  • Filtering Methods
    • Eq
    • Filter
  • Insertion Methods
    • After
    • Append
    • Before
    • Prepend
  • Selection and Manipulation Methods
    • Addclass
    • Attr
    • CSS
    • Hide
    • HTML
    • Removeattr
    • Removeclass
    • Show
    • Text
    • The $ Object
    • Toggleclass
  • Traversal Methods
    • Children
    • Find
    • Parent
    • Siblings
Question? Give us feedback → (opens in a new tab)Edit this page
Insertion Methods
Before

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;
}
AppendPrepend

Hola.js Doc