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

81
Visualizações
HTML Select With Search Option

I have a simple HTML Select, When the user enters the data in the text box if the data entered is Less than some percentage this HTML Select is displaed else it is hidden. I want to add search to it. I tried Select2, but Couldn't implement correctly. Need help The code is as follows

<select name="reason" id="reason#getProdInfo.currentRow#" style="display: none">
<option>--</option>
<option>Line feeding not available</option>
<option>WIP not available</option>  
<option>Absenteeism issue</option>
<option>Operator on other operation issue</option>
<option>Reworking due to high DHU</option>
<option>Re-check</option>
<option>Operator training issue</option>
<option>Machine out of order</option>
<option>Operator low efficiency</option>
<option>Trolley not available</option>
<option>Line feeding late arrived</option>
<option>Operator working on extra work</option>
<option>Operator late arrived</option>
<option>Engineering Support not available  </option>
</select>

The JS:

$('#prods1').on('focusout', function(){
  var element1 = document.getElementById("prods1").value;
  var element2 = document.getElementById("trgt").value;
  var calc = (element1/element2)*100
  if (calc<70){
    $("#reason1").show()
  }else{
    $("#reason1").hide()
  }
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Someone please correct me if I'm wrong here, but perhaps using a ternary for conditionally rendering the select would be easiest and simplest solution to decide if the HTML element renders?

{userInput.length > 0 
    ? <select name="reason" id="reason#getProdInfo.currentRow#" style="display: block"> 
    : <select name="reason" id="reason#getProdInfo.currentRow#" style="display: none">
}
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