Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
How to do a cascade filtering using javascript

I have a table a such

Env depot articles
100 AAA Capacitor
100 AbA Diode
100 AAA cable
100 AbA mike
100 ABC modem
900

Im extracting my data from a postgres database using php and it's working fine

Now i'm wanting to do a cascade filter to show for a specific Env the depot associated and the articles under that articles depot

For example , if i select in my dropdownlist Env = 100 , dropdownlist dépot would show me AAA / AbA / ABC then when i select AAA dropdowlist Articles will show Capacitor / cable

if i select in my dropdownlist Env = 900 , dropdownlist dépot would show me nothing so on in dropdowlist Articles

This is a sample of Data but my table contains more values .

Here is my code that tried but couldn't reach desired output

var options = $('#env').val();
var selectOptions = '';

for (i = 0; i < options.length; i++) {
  selectOptions += '<option value="' + options[i] + '">' + options[i] + '</option>';
}

$('#env').append(selectOptions).on('change', function() {
  var selected = $(this).find('option:selected').val();

  $('#depot, #articles').empty();

  $.each(envs, function(i, v) {;
    if (v.env == selected) {
      $('#depot').append('<option value="' + v.depot + '">' + v.depot + '</option>');
      $('#articles').append('<option value="' + v.articles + '">' + v.articles + '</option>');
    }
  });
});
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda