0
I have the following form:
I would like to take the value of select as you add more fields. I’m trying to take it this way, but it only returns me the Pax, IE, always the first value, even when I select the Adult or other value of select.
<table border="0" width="100%">
<tr>
<td style="padding: 5px">
<select name="TipoDocumento[]" class="form-control tipoPassageiro">
<option>Pax</option>
<option value="Adulto">Adulto</option>
<option value="Adolescente entre 12 e 18 anos">Adolescente entre 12 e 18 anos</option>
<option value="Criança entre 6 e 12 anos">Criança entre 6 e 12 anos</option>
<option value="Criança de colo de até 6 anos">Criança de colo de até 6 anos</option>
</select>
</td>
<td style="padding: 5px"><input type="text" name="NomePAX[]" class="form-control" placeholder="Nome do pax" value=""></td>
<td style="padding: 5px">
<select id="TipoDocumento" name="TipoDocumento[]" class="form-control">
<option>Tipo de documento</option>
<option value="Carteira de Identidade">Carteira de Identidade</option>
<option value="Carteira Nacional de Habilitação">Carteira Nacional de Habilitação</option>
<option value="Carteira de Trabalho">Carteira de Trabalho</option>
<option value="Certidão de Nascimento">Certidão de Nascimento</option>
<option value="Passaporte">Passaporte</option>
<option value="Cédula de Identidade Estrangeira">Cédula de Identidade Estrangeira</option>
<option value="Outros">Outros</option>
</select>
</td>
<td style="padding: 5px">
<input type="text" name="Documento[]" class="form-control" placeholder="RG da pessoa autorizada" value="">
</td>
<td style="padding: 5px">
<input type="text" name="OrgaoEmissor[]" class="form-control" placeholder="Órgão Emissor" value="">
</td>
</tr>
</table>
Jquery
$(".adicionarCampo").click(function () {
var tipoPassageiro = $(".tipoPassageiro option:selected").val();
alert(tipoPassageiro);
});
Show Sam. I’m actually trying to put together that other post and needed that answer to start building the other answer. Thank you!
– user24136