Append an HTML element to the DOM and return a removal function
$ npm install --save append-child
var appendChild = require('append-child')
var element = document.createElement('div')
var remove = appendChild(element)
//=> div appended to document.body
remove()
//=> div removed from body
var parent = document.createElement('div')
remove = appendChild(element, parent)
//=> div appended to parent
remove()
//=> div removed from parent
Returns a remove
function.
Required
Type: HTMLElement
A DOM element to insert.
Type: HTMLElement
Default: document.body
The parent element to append to.
MIT © Ben Drucker