get the value of any clicked td jquery

后端 未结 2 1700
广开言路
广开言路 2021-01-29 10:46

im traying to get the value of any clicked td and show this in a alert() window with jquery or javascript. I was trayin alote of code around the internet \"googling\" but anyone

2条回答
  •  无人及你
    2021-01-29 11:30

    Why not attach the click event directly to the td? You also need to make sure you're including jQuery...

    $( "td" ).click(function() {
        alert($(this).text());
    });
    
    
        
    id Nombre
    1 miguel

提交回复
热议问题