@cloudcmd/create-element
v2.0.2
Published
create dom element
Downloads
353
Readme
create-element
Create DOM element.
Install
npm i @cloudcmd/create-element
API
const createElement = require('@cloudcmd/create-element');
// create DOM-element with no attributes
const div = createElement('div');
// add innerHTML
const el = createElement('div', {
notAppend: false, // default
parent: document.body, // default
uniq: true, // default
innerHTML: '<span></span>',
className: 'abc',
});
// load css
const el = createElement('link', {
rel: 'stylesheet',
href: '/style.css',
parent: document.head,
});
License
MIT