# dom-element-create

> ## Installation

Latest version **1.0.3** (published 2018-06-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install dom-element-create
pnpm add dom-element-create
yarn add dom-element-create
bun add dom-element-create
```

## 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.3 |
| Published | 2018-06-07 |
| First published | 2018-06-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | vvanghelue |

## Links

- npm: https://www.npmjs.com/package/dom-element-create
- npm.io page: https://npm.io/package/dom-element-create

## Recent versions

- 1.0.3 (latest) — 2018-06-07
- 1.0.2 — 2018-06-07
- 1.0.1 — 2018-06-07
- 1.0.0 — 2018-06-07

## README

# Simple way to create a DOM element using built-in browser DOMParser function

## Installation

```bash
npm install dom-element-create
```

## Example

```javascript

const createDomElement = require('dom-element-create')

const coolElement = createDomElement(`
	<div class="foo">
		<h1>bar</h1>
		<p>hello</p>
	</div>
`)

document.body.appendChild(coolElement)

```

Or, with callback :

```javascript

const createDomElement = require('dom-element-create')

const coolElement = createDomElement(`
	<div class="foo">
		<h1>bar</h1>
		<p>hello</p>
	</div>
`, (element) => { //element === coolElement
	element.addEventListener('click', () => {
		alert('Hi, folks !')
	})
})

document.body.appendChild(element)

```

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