I have this element at index.html:
<div id="app"></div>
How can I write a query to get that DOM element?
And create a new UL element and append it to the previously mentioned <div> element?
Like here:
function displayUsers(users) {
// ??????????
};
>Solution :
const ul = document.createElement('ul')
const li = document.createElement('li')
const textNode = document.createTextNode('some text')
li.appendChild(textNode)
ul.appendChild(li)
document.getElementById('app').appendChild(ul)
an example here
https://www.w3schools.com/jsref/met_node_appendchild.asp