1.0.0 • Published 8 years ago

append-child v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

append-child Build Status

Append an HTML element to the DOM and return a removal function

Install

$ npm install --save append-child

Usage

var appendChild = require('append-child')
var element = document.createElement('div')

var remove = appendChild(element)
//=> div appended to body

remove()
//=> div removed from body

API

appendChild(element, [parent]) -> function

Returns a remove function.

element

Required
Type: HTMLElement

A DOM element to insert.

parent

Type: HTMLElement
Default: document.body

The parent element to append to.

License

MIT © Ben Drucker