Dropdownlist is not passing the value on the variable

0

I'm trying to do a validation in javascript, but I'm not even able to pass what's inside a DROPDOWNLIST to the variable to make the comparison ... The ProjectName gets perfectly what it has inside the variable, I believe it is a TextBox. Since the ProjectNamePai does not receive, it is a Dropdownlist ...

Follow the codes below:

function validacaoCadastrarOS() {
    var NomeProjetoPai = document.getElementById("ProjetoId").value;
    var NomeProjetoFilho = document.getElementById("ProjetoNome").value;
    alert(NomeProjetoPai);
    alert(NomeProjetoFilho);
    if (NomeProjetoPai === NomeProjetoFilho) {
        alert("Nome da atividade não pode ser igual ao nome do Projeto");
        return false;
    }
    else {
        return true;
    }
}
    
asked by anonymous 14.07.2015 / 13:48

1 answer

0

I solved it with JQUERY, now it can get what's inside Dropdownlist ...

var NomeProjetoPai = $("#ProjetoId :selected").text();
    
14.07.2015 / 15:47