Skip to content

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

License

Notifications You must be signed in to change notification settings

danxschz/generate-element

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published