1
> function
> editar_etapa_projeto(etapa_projeto_id,etapa_id,dias_total,data_inicial){
> $('#etapa_projeto_id').val(etapa_projeto_id);
> $('#etapa_id').find('option[value='+etapa_id+']').attr('selected',true');
> $('#dias_total').val(dias_total);
> $('#data_inicial').val(data_inicial); }
I want with this Javascript function, that it fills the inputs of ids # such as the values received by input variables in the function.
It is working for the inputs, it takes the value of the variable, and plays in the value of the input.
But in select no,
i need it to check the value that is received in the variable etapa_id, go to the select of id #etapa_id, and a Selected in the select option where that value is.
$('#etapa_id').find('option[value='+etapa_id+']').attr('selected’,'true');
I found that it selects yes, but by error in firefox compatibility to Selected="Selected", will not.
You have an extra single quote after
true
and different quote types... Forehead with.attr('selected', true);
– Sergio
As far as I know, it’s the same rule to get select value if it’s selected, as per the @Kaduamaral response.
– Ivan Ferrer
It is taking but does not select the . val
– Barack