Dear, I'm trying to add value in a select with javascript.
I have 2 select's, 1 - Company and 2 - Branch. I will enter different values depending on the value chosen in the 1 - Company.
I looked in some places but not found a solution to the problem. I have the following code.
<script type="text/javascript">
document.getElementById("teste").onClick = function() {
alert("239309");
if(document.getElementById("selectEmpresa").value() == "Escolha uma opção"){
var comboRamo = document.getElementById("selectRamo");
var opt0 = document.createElement('option');
opt0.value = "0";
opt0.text = "Selecione uma empresa";
comboRamo.add(opt0, comboRamo.options[0]);
}
}
</script>
This "test" is a button I'm using to test. But I want to put for any action performed on select 1 - Company.