nowiko
nowiko

Reputation: 2557

innerHtml form array

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

Answers (2)

Nicolas Albert
Nicolas Albert

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

Hamix
Hamix

Reputation: 1335

Try: innerHTML Link

document.getElementById("registration_errors").innerHTML = htmlErrors;

Upvotes: 3

Related Questions