Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
85
rated 0 times [  92] [ 7]  / answers: 1 / hits: 68946  / 13 Years ago, fri, june 10, 2011, 12:00:00

I have some code that looks like this:



document.getElementById(error).style.display = 'block';


and when this happens I also want to display the error that is supposed to be shown which is stored in another JS variable. How can I add the value of that variable to the div which has id=error



Thanks!


More From » javascript

 Answers
3
var errorMsg = <p>Example error message</p>
document.getElementById(error).innerHTML = errorMsg

[#91762] Thursday, June 9, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
leog

Total Points: 225
Total Questions: 113
Total Answers: 118

Location: Oman
Member since Wed, Apr 12, 2023
1 Year ago
;