0

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

1 Answer 1

1

Change:

node.setAttribute("value" , c);

to:

node.innerHTML = c;

The value attribute is only used for user input elements (<input>, <option>, etc.).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.