Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    fd-insert-afterpublic

    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.

    Keywords

    install

    npm i fd-insert-after

    Downloadsweekly downloads

    4

    version

    1.0.0

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar
    • avatar