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

263
Vistas
Jquery - Hyperlink cannot be click

I have table, then table row can be clicked. But some cell, cannot be clicked if there is a hyperlinks. Because if i allow it, there will be 2 action. Action on tr click and action on hyperlink click.

so i decide to disable thats cell.

$("tbody").on("click", "tr td:last-child", function() { 
   return false;
});

But when i do this,, my hyperlink cannot be clicked.

This is my full script

$("tbody").on("click", "tr td:last-child", function() { 
    return false;
});
$("tbody").on("click", "tr td:nth-last-child(2)", function() { 
    return false;
});
$("tbody").on("click", "tr", function() {   
    console.log('tr click');
});

https://jsfiddle.net/1twzdm9c/18/

In my version, i cant click tr and hyperlink,, but in jsfiddle, im still can click tr but hyperlink cannot wont effect.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Just not bind the click in first place

$("tbody").find("tr td").not(":last,:nth-last-child(2)").on("click", function() {   
    console.log('tr click');
});

https://jsfiddle.net/27jygkqx/

about 4 years ago · Juan Pablo Isaza Denunciar

0

add this attribute in non clickable td

<td data-click="false">....
 <td data-click="false">...

<script>  
    $("tbody").on("click", "tr td:not([data-click='false'])", function() {   
        console.log('tr click');
    });
</script>
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