Javascript function is giving error

Asked

Viewed 31 times

1

This function is not even being called and is giving error. It does not say exactly the error, but it gives error when entering the form:

function ChangeSituacao(){
        var vRads = document.getElementsByName('ind_situacao');
        for(var i = 0; i < vRads.Length; i++){
            alert(vRads[i].checked);
    }

The idea go through a collection of Radiobutton and pick up what is checked and then apply the business rule. What is wrong this function?

  • 2

    You’re not shutting down your for

  • 1

    .Length must be in small print... => .length.

1 answer

4


Yours is not being closed

function ChangeSituacao(){
        var vRads = document.getElementsByName('ind_situacao');
        for(var i = 0; i < vRads.Length; i++){
            alert(vRads[i].checked);
        } //Você esqueceu de fechar o for aqui
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.