Create DOM elements programatically

const div = document.createElement('div');
div.setAttribute('id', 'my-div');
div.className = 'my-class';
document.body.appendChild(div);
// or use any other container instead of body
document.querySelector('#element-with-id').appendChild(div);