This small library offers a way to dynamically create HTML elements using tag names as functions.
- The library uses a
Proxy, so the element functions are lazy loaded (on demand). - Tag function names are case insensitive
(e.g.tags.DIVortags.div,const {h3, H3, DIV, p, P} = tags)
The first parameter of a tag function may be an Object literal,
containing textContent / innerHTML /
reflected element properties / (data-)attributes.
- address the
classNameproperty as{class: 'class1 class2 ...'} - address
attributesas{attributes: {attr1: '...', ...} - address
data-attributesas{data: {one: '...', ...}} - address
innerHTML/textContentas{html: ...}or{text: ...}
Check the demonstration page to learn more.
Enjoy!
For a more comprehensive DOM helper, check my JQuery alike module (JQx).