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

185
Views
¿Cómo deshabilitar el botón (no debería hacer nada) si cualquiera de las entradas está vacía?

ingrese la descripción de la imagen aquí , muestra Nan cuando no hay un número, ¿cómo puede deshabilitarlo?

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

0

Deshabilite los botones en html agregando un atributo deshabilitado. Escriba un controlador de cambio para las entradas donde los botones están habilitados solo si hay valor.

Ref: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event

 const input1 = document.querySelector('#num1'); const input2 = document.querySelector('#num2'); input1.addEventListener('change', handleButton); input2.addEventListener('change', handleButton); function handleButton() { if(input1.value && input2.value) { document.querySelector(".button").removeAttribute("disabled"); } else { document.querySelector(".button").setAttribute("disabled", "disabled"); } }

Puede orientar los botones por el nombre de clase que ha utilizado. He usado .button en la respuesta.

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!