• Jobs
  • About Us
  • Jobs
    • Home
    • Jobs
    • Courses and challenges
  • Businesses
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

117
Views
¿Cómo hacer que mi botón de reinicio funcione en HTML sin el formulario?

aquí está mi código

Intenté usar javascript con onClick pero luego mi botón Enviar no funciona. Luego intenté cambiarlo al botón normal y todavía no funciona. Intenté ponerlo en el formulario y todavía no funciona. Entonces, no sé cómo restablecer el botón de mi formulario. Este es mi trabajo escolar y todavía soy estudiante, así que por favor ayúdenme. Agradecería mucho su ayuda.

over 3 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Los tipos de formulario: restablecer y enviar necesitan un contexto. Quiero decir que tienes que envolver todas las entradas dentro de un formulario. <form>....</from> . Luego reset tiene el contexto para restablecer todos los campos dentro de su contexto/formulario.

De lo contrario, si no desea utilizar el formulario, puede hacerlo mediante Javascript.

 function reset() { document.getElementById('input_1').value = '' document.getElementById('input_2').value = '' }
 <input id="input_1" value="Hello"><br/> <input id="input_2" value="World"> <br/> <button onclick="reset()">RESET</buton>

over 3 years ago · Juan Pablo Isaza Report

0

Debe usar javascript para restablecer sus inputs

Aviso: Tenga en cuenta que la tecla Enter también funciona al usar el formulario

 <div> <div id="like-form"> <input type="text" placeholder="Name" /> <input type="email" placeholder="Email" /> <input type="password" placeholder="Password" /> </div> <button type="button" id="like-reset"> Reset </button> </div>

Puede usar Ajax para enviar información, pero para reset

 document.getElementById("like-reset").addEventListener("click" () => { // forEach [].slice.call(document.getElementById("like-form").children).forEach(input => { input.value = ""; }); // For const inputs = document.getElementById("like-form").children; for (let i = 0; i < inputs.length; i++) { inputs[i].value = ""; } });
over 3 years ago · Juan Pablo Isaza Report

0

U debe configurar todas las entradas y el botón de reinicio dentro del formulario. Al igual que:

 <form> <input type="text"> <input type="reset" value="Reset"> </form>

De esa manera debería funcionar.

over 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.

Andres GPT

Show me some job opportunities
There's an error!