npm.io
0.1.6 • Published 3 years ago

create-and-append-element

Licence
ISC
Version
0.1.6
Deps
0
Size
3 kB
Vulns
0
Weekly
0

create-and-append-element

This package allows you to create and place any HTML tag of your choice with ease.

This is my first package, hope it will be helpful. :)

Install

Install with npm:

$ npm install create-and-append-element

Usage

import createAndAppendElement from 'create-and-append-element';

// createAndAppendElement('tagName', whereToAppend, 'class', { attribute: value })

const link = createAndAppendElement('a', document.body, 'link', {
    href: 'https://url.com',
    // attributes...
});

const img = createAndAppendElement('img', link, 'image', {
    src: 'https://image.png',
    wdth: 500
});

About

Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/simonK605/create-and-append-element/issues/new).

Author

Simon Karapetyan

Keywords