Im wondering how to do a dymanic select. Im working with java using servlets and jsp. I know jquery is a good option for doing this but i dont understand how.
I have a parent table of nationalities that has the following fields, Nationality, state_id, city_id.
<div class="form-group">
<label>Nacionalidad: </label>
<select class="form-control col-8" name="Nationalities" required >
<!-- Esto debería leerlo desde una DB -->
<option selected value="">Seleccionar...</option>
<%
for (Nationality : listaN) {
%>
<option value="<%=.getID()%>" ><%=m.getDescription() %></option>
<%
}
%>
</select>
</div>
<div class="form-group">
<label>State: </label>
<select class="form-control col-8" name="States" required >
<!-- Esto debería leerlo desde una DB -->
<option selected value="">Seleccionar...</option>
<%
for (State: listaS) {
%>
<option value="<%=.getID()%>" ><%=m.getDescription() %></option>
<%
}
%>
</select>
</div>
<div class="form-group">
<label>Cities: </label>
<select class="form-control col-8" name="Cities" required >
<!-- Esto debería leerlo desde una DB -->
<option selected value="">Seleccionar...</option>
<%
for (City: listaC) {
%>
<option value="<%=.getID()%>" ><%=m.getDescription() %></option>
<%
}
%>
</select>
</div>
I need to select a Nationality and depending in my selection the options in the next select should be specific for the selection before.