Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

93
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda