Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

80
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!