i'm try set selected with javascript and jquery but dont set the value, my code:
<select class="form-control" id="destino" name="destino" required>
</select>
this is my select for append the options i use a cycle for:
for(i=0; i<subdirectorios.length; i++){
temporal_value =path_directorioPrincipal.concat(subdirectorios[i]);
var option = $("<option value="+temporal_value+">"+ subdirectorios[i] +"</option>");
//append option
$("#modalProceso #destino").append(option);
}
the output:
i don't understand why set value as :
value="media/gestionDocumental/Operativos/Prueba" produccion=""
in the console return this value:
media/gestionDocumental/Operativos/Troquelado
media/gestionDocumental/Operativos/Prueba Produccion
for set selected use:
$('#destino option:contains("' + destino_path + '")').attr("selected", true)
//or this:
$('#destino').val(destino_path);
but dont set selected. please any suggest..thanks..!!