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

187
Vistas
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 Respuestas
Responde la pregunta

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 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