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

133
Views
Cómo hacer que se active un evento onClick para ciertos botones secundarios de un <tr>

Tengo una fila de tabla dentro de una tabla. Dentro de esta fila de la tabla tengo 4 botones. Quiero usar jquery para activar un onClick para cualquier botón de la fila, excepto el primero. ¿Hay una manera fácil de seleccionar el <tr> en lugar de recrear un onClick para cada botón?

 <table class="table table-striped stickeyHeaders"> <tr id="buttonRow"> <td><input type="radio" name="SelectedStoreRoles" class="store-privs" value="1"/> <td><input type="radio" name="SelectedStoreRoles" class="store-privs" value="2"/> <td><input type="radio" name="SelectedStoreRoles" class="store-privs" value="3"/> <td><input type="radio" name="SelectedStoreRoles" class="store-privs" value="4"/> </tr> </table>

Este es mi proceso general, pero necesito ayuda para desarrollarlo por completo.

 $('#buttonRow').children("Some Filter that says value > 1").On('Click, function({}));
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puede usar el selector :gt para evitar el primer elemento:

 $('#buttonRow').find(":radio:gt(0)").on('click', e => { console.log(e.target.value); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script> <table class="table table-striped stickeyHeaders"> <tr id="buttonRow"> <td><input type="radio" name="SelectedStoreRoles" class="store-privs" value="1" /></td> <td><input type="radio" name="SelectedStoreRoles" class="store-privs" value="2" /></td> <td><input type="radio" name="SelectedStoreRoles" class="store-privs" value="3" /></td> <td><input type="radio" name="SelectedStoreRoles" class="store-privs" value="4" /></td> </tr> </table>

about 4 years ago · Juan Pablo Isaza Report

0

Puede usar una combinación de pseudoclases :not y :first-child

 $('#buttonRow') .children('td:not(:first-child)') .children('input') .on('click', function() { console.log(this) })
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!