@bshowen/htmlelement
v1.0.1
Published
Create html elements
Downloads
2
Readme
Create HTML elements with ease
A function that allows you to create an html element with an id, classes, attributes, and innerText.
The function returns an Html element.
Syntax
new HtmlElement(options);
options = {
type: String, //The type of Html element; Div, h1, form, li, etc.
id: String,
classList: Array, //Array of string classnames.
attributes: Hash/Object, //Key/Value object of attribute names and their values.
innerText: String
}
Example
const myTitleElement = new HtmlElement({
type: "h1",
id: "myFirstTitle",
classList: [
"className_1",
"className_2"
],
attributes: {
hidden: false,
somethingElse: true,
},
innerText: "Bradley"
})