Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/06/2020, 13:25
Avatar de ArturoGallegos
ArturoGallegos
Moderador
 
Fecha de Ingreso: febrero-2008
Ubicación: Morelia, México
Mensajes: 6.774
Antigüedad: 16 años, 1 mes
Puntos: 1146
Respuesta: Modificar atributo mínimo de un input, depende del valor de otro input

Viendo que has hecho algo aqui tienes una posible solucion

Nota: no uses jQuery cuando no lo necesitas para algo util

Código HTML:
Ver original
  1. input1
  2. <input type="number" id="input1">
  3. <br><br>
  4. input2
  5. <input type="number" id="input2">

Código Javascript:
Ver original
  1. const input1 = document.getElementById('input1');
  2. const input2 = document.getElementById('input2');
  3.  
  4. input1.addEventListener('input', (event) => {
  5.   const { currentTarget } = event;
  6.   if(!currentTarget.value) return;
  7.   const minValue = Number(currentTarget.value) * 1000;
  8.   input2.setAttribute('min', minValue);
  9.   if(Number(input2.value) < minValue){
  10.     input2.value = minValue;
  11.   }
  12. });