Reputation: 5
I am trying to log numbers from an HTML element without predefining a list. below is what I am currently using to attempt this but for some reason it is not adding the output to the created list element. note that the output is random. any help is appreciated.
function Log(c){
var c = document.getElementById('out').innerHTML;
var node=document.createElement("LI");
node.setAttribute("class" , f);
document.getElementById("list").appendChild(node);
node.setAttribute("value" , c);
var f = y=y++;++y
var y = 0
}
Thank you
Upvotes: 0
Views: 35
Reputation: 781751
Change:
node.setAttribute("value" , c);
to:
node.innerHTML = c;
The value
attribute is only used for user input elements (<input>
, <option>
, etc.).
Upvotes: 1