• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
JavaScriptSource

JavaScriptSource

Search 5,000+ Free JavaScript Snippets

  • Home
  • Browse Snippets
    • Addon
    • Ajax
    • Buttons
    • Cookies
    • CSS
    • Featured
    • Forms
    • Games
    • Generators
    • Image Effects
    • Math Related
    • Miscellaneous
    • Multimedia
    • Navigation
    • Page Details
    • Passwords
    • Text Effects
    • Time & Date
    • User Details
Home / Addon / insertAfter()

insertAfter()

insertAfter()

Use this snippet to insert a node after another node. Quite handy in laying out Web pages.

<!– Add this snippet to your existing JavaScripts  –>

/* This script and many more are available free online at
The JavaScript Source :: http://javascriptsource.com
Created by: Public Domain */

function insertAfter(parent, node, referenceNode) {
  parent.insertBefore(node, referenceNode.nextSibling);
}

Addon

Related Snippets:

  • Multiple onLoad 2
  • Remove HTML Tags
  • getElementsByAttribute
  • Window Print Method

Primary Sidebar

Popular Posts

Story Generator

IP Grabber – get a users IP address with JavaScript

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2025 JavaScriptSource.com

  • About
  • Privacy Policy
  • FAQ
  • Jobs For Developers