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

211
Views
¿Cómo puedo eliminar el texto de intervalo hecho en js?

¿Cómo puedo eliminar u ocultar el texto mientras alguien en mi formulario ingresa por segunda vez y proporciona los datos correctos? Quiero decir, cuando alguien por primera vez da un mensaje incorrecto, el texto mostrará "¡El nombre no puede estar vacío!" y luego dar datos correctos y el texto está ahí pero invisible.

 errorFunc(fname, 'First Name cannot be empty!') } else { successFunc(fname) } if (lastName === '') { errorFunc(lname, 'Last name cannot be empty!') } else { successFunc(lname) } function errorFunc(req, message) { const formControl = req.parentElement; const span = formControl.querySelector('span'); span.innerText = message; req.classList.add('error'); span.classList.add('error-text'); req.classList.remove('success'); } function successFunc(req) { const formControl = req.parentElement; const span = formControl.querySelector('span'); req.classList.add('success'); req.classList.remove('error') span.classList.remove('error-text') }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Tienes 2 opciones:

  • Puede eliminar el intervalo con la función .remove().

     span.remove()
  • También puede mantener el elemento span pero eliminar el texto.

     span.innerText = ""
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!