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
¿Cómo elimino la entrada escrita por el usuario en una etiqueta de entrada después del envío del formulario a través de vanilla javascript?

 <input type="number" class="setter" id="day-set" name="day-set" value="day"max="30" min="0" placeholder="00"onkeyup="if(parseInt(this.value)>30){ this.value =30; return false;}">

¿Cómo hago para que la entrada escrita por el usuario en el campo de entrada se borre cuando se presiona un botón de envío (el que no actualiza la página)?

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

0

puede agregar esto a la función onclick de su botón y reemplazar myForm con la identificación de su elemento de formulario

 document.getElementById("myForm").reset();
about 4 years ago · Juan Pablo Isaza Report

0

 <html> <body> <p>Clear the input field when you click on the button:</p> <button onclick="document.getElementById('myInput').value = ''">Clear input field</button> <input type="text" value="Blabla" id="myInput"> </body> </html>

También puede escribir el javaScript entre la etiqueta del script en una función o de cualquier otra forma que desee.

about 4 years ago · Juan Pablo Isaza Report

0

Puede crear una función y agregarla al evento onSubmit de su formulario (asumiendo que tiene un formulario) y luego dentro de esa función solo necesita borrar el valor usando algo como esto:

 document.getElementById('day-set').value = ''

Ejemplo:

 <form onsubmit="myFunction()"> <input type="number" class="setter" id="day-set" name="day-set" value="day"max="30" min="0" placeholder="00"onkeyup="if(parseInt(this.value)>30){ this.value =30; return false;}"> <input type="submit"> </form> <script> function myFunction(){ document.getElementById('day-set').value = '' } </script>
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!