Holding an event in the first option does not work!
See an example - by clicking Pagina 1
nothing happens! Only if you first click on another option and then click on it.
function irPara( ) {
var list = document.forms[0].urlList.value;
console.log (list);
}
<form>
<select name="urlList" size="1" onChange="irPara( )" style=" font-family: ; color:#F5F5F5; background-color:navy; font-size:13px">
<option value="/">Pagina 1</option>
<option value="https://google.com/">Pagina 2</option>
<option value="https://uol.com/">Pagina 3</option>
</select>
</form>
So the solution is to put an option in the first position for English see, capisce?
vetorAux = ["CARROS","Ferrari","Porshe"];
vetorAux.forEach(function(item){
$('select').append('<option value="' + item + '">' + item + '</option>');
});
$('#mySelect').change(function() {
$("#mySelect option[value='CARROS']").prop("disabled",true);
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<body>
<select id="mySelect">
<option>Selecione</option>
</select>
You want her to be disabled?
– Sam