When you want to use Javascript to change HTML, how do you know when to use either of the following?
document.getElementById("randomNumber").value = number;
document.getElementById("randomNumber").innerHTML = number;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Setting the
valueis normally used for input/form elements.innerHTMLis normally used for div, span, td and similar elements.Here is a link showing the use of ID.value:
http://www.javascript-coder.com/javascript-form/javascript-form-value.phtml