Is there a method to use plain old vanilla javascript (sans frameworks) to convert a html template string into a Html element?
Here's what i've things that i've tried:
function renderBody(selector = body, template) {
const prop.text = 'foobar';
const templateString = `<div id='test'>${prop.text}</div>`
const test = document.createElement('div');
test.innerHTML = templateString;
document.querySelector(selector).appendChild(test);
}
This implementation works but it uses innerHTML and adds an extra wrapped div. There a way to do that without the extra div
?