Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
How to have an onClick event fire for certain radio button children of a <tr>

I have a table row inside of a table. Inside this table row I have 4 buttons. I want to use jquery to fire an onClick for any button in the row except for the 1st one. Is there an easy way to select the <tr> itself instead of recreating an onClick for every button?

<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>

Here is my general though process but need some help to flesh it out all the way

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

0

You can use the :gt selector to avoid the first element:

$('#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 Denunciar

0

You can use a combination of :not and :first-child pseudo-classes

$('#buttonRow')
  .children('td:not(:first-child)')
  .children('input')
  .on('click', function() {
    console.log(this)
  })
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda