Problem:
I’m working on a problem for school and am confused on how to approach it. They want me to create an HTML element AND(bolded in text) add a property to it. Any help is appreciated. Here is my code and the question.
Here is my code and the question.
enter image description here
enter image description here
Solution:
Try this code, maybe it will help
const listTemple = ['Temple A','Temple B','Temple C']
let element = ''
listTemple.forEach(temple => {
element += `<h3 templeNames="${temple}" >${temple}</h3>`
})
document.querySelector('#yourElementId').innerHTML = element