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

103
Views
botón detener/deshabilitar después de x cantidad de clics

Tengo una tabla y agregas filas usando append. ¿Cómo detengo o deshabilito el botón después de 5 clics o 5 filas adjuntas o cualquier cantidad necesaria?

este es el codigo:

 <input class="btn btn-primary" type="button" id="addbutton" value="More names" title="Add more names"> <script type="text/javascript"> var i = 1; $("#addbutton").click(function () { $("#table").append('<tr>'+ '<td><input class="form-control input-lg" type="text" name="name" required />'+ '</td>'+ '<td><button type="button" class="removebutton" title="Remove this row">X</button> </td></tr>').find("input").each(function () { }); i++; });; $(document).on('click', 'button.removebutton', function () { $(this).closest('tr').remove(); return false; }); </script>
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Desea deshabilitar el botón para que haya un atributo en HTML, podemos usarlo. La cuestión es que deberías mantener el valor de i == 0 en lugar de 1.

 if(i == 5){ $("#addbutton").attr('disabled','disabled'); }

Así es como puede agregar un atributo deshabilitado. Espero que esto te ayude.

about 4 years ago · Santiago Trujillo 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!