dom create element

JavaScript
var btn = document.createElement("BUTTON");   // Create a <button> element
btn.innerHTML = "CLICK ME";                   // Insert text
document.body.appendChild(btn);               // Append <button> to <body>var btn = document.createElement('div'); 
btn.setAttribute("id", "div1");// A function to create elements in JS
function elementFactory(tag, text) {
    const el = document.createElement(tag);
    el.textContent = text;
    return el;
}

const someListItem = elementFactory("li", "some text"); 
var newDiv = document.createElement("div");
document.body.appendChild(newDiv);
Source

Also in JavaScript: