anyone know how to display innertext of div, i tried but it just returns an empty string
window.onload = (event) =>{
var usernames = "willy wonka"
var privatechannel = document.createElement("div")
privatechannel.setAttribute("onclick", "refreshdiv()")
privatechannel.classList.add("friendurl")
privatechannel.setAttribute("id", "friendurl");
privatechannel.setAttribute("value", usernames);
privatechannel.appendChild(document.createTextNode(usernames))
};
function refreshdiv() {
const usernamed = document.getElementById("friendurl").innerText
console.log(usernamed)
}