Skip to content

fp-dom/fd-insert-after

Repository files navigation

fd-insert-after

Build Status npm version

insert after a DOM element in a functional way.

Installation

npm install fd-insert-after --save

Usage

Let the DOM be like:

<div id="parentElement">
  <span id="childElement">foo bar</span>
</div>```


```js
let insertAfter = require('fd-insert-after');

let sp1 = elem("span","meow")
,sp2 = document.getElementById("childElement")
,parentDiv = sp2.parentNode

insertAfter(sp1, sp2);

selectOne('#parentElement').children[0].innerText; // => 'foo bar'

API

insert-after :: refNode -> newNode

A curried function that takes in:

  • refNode The node after which newChild is inserted.

  • newChild The node to insert.

About

insert after a DOM element in a functional way.

Resources

License

Stars

Watchers

Forks

Packages

No packages published