Inserts an HTMLElement after another one that is passed in.

Parameters:
NameTypeDescription
elementHTMLElement | NodeList

The element to insert.

targetHTMLElement | NodeList

The target to insert the element after.

Since
  • 1.0.0
Returns:
Type: 
void
Example
import { insertAfter, getNodes } from "@gravityforms/utils";

function Example() {
  const target = getNodes( '.some-custom-selector', false, document.body, true )[ 0 ];
  const div = document.createElement( 'div' );
  insertAfter( div, target );
}