Reputation: 2557
I have read this article Need helping with innerHTML and array input variables. But when i do this:
if (errors.length > 0) {
var htmlErrors ='';
for (var i = 0; i < errors.length; i++) {
htmlErrors += errors[i];
}
document.getElementById("registration_errors").innerHtml = htmlErrors;
I get white screen. Where is my mistake?
Upvotes: 1
Views: 122
Reputation: 2596
The if is not closed and this is innerHTML
instead of innerHtml
:
if (errors.length > 0) {
var htmlErrors ='';
for (var i = 0; i < errors.length; i++) {
htmlErrors += errors[i];
}
document.getElementById("registration_errors").innerHTML = htmlErrors;
}
Upvotes: 1