# append-child

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

Latest version **1.0.0** (published 2016-07-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install append-child
pnpm add append-child
yarn add append-child
bun add append-child
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-07-04 |
| First published | 2016-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Ben Drucker |
| Maintainers | bendrucker |
| Keywords | html, dom, append, child, remove, appendChild, removeChild |

## Links

- npm: https://www.npmjs.com/package/append-child
- Repository: https://github.com/bendrucker/append-child
- Homepage: https://github.com/bendrucker/append-child#readme
- Issues: https://github.com/bendrucker/append-child/issues
- npm.io page: https://npm.io/package/append-child

## Dependencies (1)

- [global](https://npm.io/package/global.md) ~4.3.0

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-07-04

## README

# append-child [![Build Status](https://travis-ci.org/bendrucker/append-child.svg?branch=master)](https://travis-ci.org/bendrucker/append-child)

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


## Install

```
$ npm install --save append-child
```


## Usage

```js
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](http://bendrucker.me)

---
_Source: https://npm.io/package/append-child · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
