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

183
Views
How to set max or min values based on selected input

I have selected input for set max or min values in another input field.

Selected Input

<select name="SelectedInput" required>
    <option value="a">A</option>
    <option value="b">B</option>
</select>

input field where max value will be set

<input type="number" name="price" id="price_id" min="0" step="0.01" required>

Conditions

If I select A option, I want to set max value in input field < 5000.

If I select B option, I want to set min value in input field >= 5000.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Selected Input :

<select name="SelectedInput" id="prooftype" required>
    <option value="a">A</option>
    <option value="b">B</option>
</select>

Input field where max value will be set :

<input type="number" name="price" id="price_id" min="0" step="0.01" required>

And then include javascript codes :

<script type="text/javascript">
var selectedopt;

$('#prooftype').change(function(){
   selectedopt=  $(this).val();

   //Add your condition here, and  check the selected option value:
  if(selectedopt== "a")
  {
   //Set input min and max value based on the selected option value.
   $('#price_id').attr('maxlength','4999');
  }
  elseif(selectedopt== "b")
  {
   $('#price_id').attr('minlength','5000');
  }
  // And so on........
})
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!