I have this code in PHP that repeats me 10 times the same select with the same information.
for ($i=1; $i < 11; $i++)
{
$output.='
<div class="form-group">
<label>Prioridad '.$i.' de horario</label><br>
<select class="form-control selectDisable">
<option selected disabled>Elige una opción</option>
<option value="1">Horario: 00:00 - 00:00 Break: 00:00 - 00:00 Descanso: Lunes</option>
<option value="2">Horario: 00:00 - 00:00 Break: 00:00 - 00:00 Descanso: Martes</option>
<option value="3">Horario: 00:00 - 00:00 Break: 00:00 - 00:00 Descanso: Miércoles</option>
<option value="4">Horario: 00:00 - 00:00 Break: 00:00 - 00:00 Descanso: Jueves</option>
<option value="5">Horario: 00:00 - 00:00 Break: 00:00 - 00:00 Descanso: Viernes</option>
<option value="6">Horario: 00:00 - 00:00 Break: 00:00 - 00:00 Descanso: Sábado</option>
<option value="7">Horario: 00:00 - 00:00 Break: 00:00 - 00:00 Descanso: Domingo</option>
</select>
</div>';
}
This I have with Jquery that eliminates the option selected in the other select
$(document).on('change','.selectDisable',function(){
$(this).siblings().find('option[value="'+$(this).val()+'"]').remove();
});
The problem is that he does not execute it, apparently for the <div class="form-group">
since apparently he is not finding brothers within the same DIV.
I had already asked the question above here:
Again, if I remove the div from the form-group it does it well, but since I can handle it with that class, I thought of
$(document).on('change','.selectDisable',function(){
$(this).closest('.form-group').find('.selectDisable').siblings().find('option[value="'+$(this).val()+'"]').remove();
});
But it did not come out, any suggestions?