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

87
Vistas
Updating my webpage when a new value from a dropdown is selected

Assume that I the following JS function which generates a table of number type inputs of the given number of rows and columns and displays it in the given div;

generate_table(3,3,'display_id')

I wish to have a dropdown to give the user a choice between 2 and 6 for the size of the matrix that they wish for the det(A) to be calculated. Up to this point I have used button to have a new input table to be generated. How can I make it so that the size of the table gets updated as a new value from the dropdown is selected ?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can use the change method as eventlistener to run your function.

jQuery Solution something like this:

$('#yourSelectTag').on('change', function() {
    var optionVal = $(this).val();
    generate_table(optionVal,'display_id');
});

Or plain js:

document.getElementById('#yourSelectTag').addEventListener('change',function(){
    var optionVal = this.value;
    generate_table(optionVal,'display_id');
});
about 4 years ago · Juan Pablo Isaza Denunciar

0

You can use a select dropdown.

<select class="form-control" id="select-element">
    <option value="2-2">2 By 2</option>
    <option value="2-3">2 By 3</option>
</select>

Assuming you are using jQuery.

$('#select-element').on('change', function() {
   var value = $(this).val();
   var matrix = value.split("-");
   generate_table(matrix[0], matrix[1],'display_id');
});
about 4 years ago · Juan Pablo Isaza Denunciar
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