I have a simple HTML page where I am trying to populate a label with a JavaScript variable
<html>
<body onload="loading();">
<div>
<h4>Main Page</h4>
<label id="cookie1" style="color: #0026ff"/>
<!--MORE CODE-->
</div>
</body>
</html>
My Javascript function is shown below. It will not populate the label on the html page but if I change the label to a textfield it will work (but i want a label). I have also used 'innerhtml' which does populate the label but it ONLY shows this label. I have more fields and buttons that are erased or hidden if i use 'innerhtml'. Is there something I am missing?
function loading() {
var val1 = "Site: " + getCookie("storeSite");
document.getElementById("cookie1").value = val1;
}