I have the following code
var eventbar = document.createElement("Div");
eventbar.id = "eventa";
eventbar.className= "event";
eventbar.onclick = 'createpopupdata(this)';
eventbar.innerHTML = "Click here";
document.getElementById("body").appendChild(eventbar);
However when it creates the object inside the HTML my inspector shows no onClick property in the HTML Div that is created. Wondering were I'm going wrong as I have tried multiple ways posted here. (Obviously sans the quotes runs the function immediately).
Edit: I'm wonedering if I have to do something special like create a listener for the object or if there is an easy solution.
eventbar.onclick = 'createpopupdata(this)';witheventbar.setAttribute('onclick', 'createpopupdata(this)');