I'm a beginner in working with JQuery, and I'm having a hard time making a% dynamic% working.
When choosing the first select
a value the second select
should only display the select
with options
terminated by the value selected in the first class
. The same schema works on the third select
in relation to the first.
I used a functional script, but to adapt it it lost functionality, but it is written more or less as you would need it.
<div class="form-group">
<label class="col-sm-3 control-label">Instituição</label>
<div class="col-sm-6">
<select name="instituicao_tur" required="required" class="form-control" id="instituicao_tur">
<option value="0">Selecione</option>
<option value="1"/>Instituição 1
<option value="2"/>Instituição 2
<option value="3"/>Instituição 3
</select>
</div>
</div>
$(document).ready(function() {
$('#instituicao_tur').change(function() {
if ($(this).val() == "0") {
$('.curso_zero').hide();
}
});
$('#instituicao_tur').change(function() {
if ($(this).val() == '1') {
$('.id_cur1').show();
}
});
$('#instituicao_tur').change(function() {
if ($(this).val() == '2') {
$('.id_cur2').show();
}
});
$('#instituicao_tur').change(function() {
if ($(this).val() == '3') {
$('.id_cur3').show();
}
});
});
});
jSFiddle with the base code.