generate-element
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published
logo

Generate Element

Create a new HTML element and specify class, text content and attributes in a single function

contributors last update license

GitHub · npm


Getting Started

Install

In order to setup and use this package, you will need to:

Install dependency

  npm install --save-dev generate-element

Import the module in your JavaScript file

  import generateElement from 'generate-element'

Usage

Run the function

  generateElement(type, class, textContent, { attributes })

Example

  const anchorElement = generateElement('a', 'example', 'Click me', { href: '#', title: 'This is an example' })

To skip any parameter, pass false as the argument

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Daniel Sanchez (@danxschz) - danxschz@gmail.com

Package Sidebar

Install

npm i generate-element

Weekly Downloads

3

Version

1.0.6

License

MIT

Unpacked Size

4.03 kB

Total Files

5

Last publish

Collaborators

  • danxschz