开发者

How to find table cell value that is clicked from ASP.NET MVC Page?

开发者 https://www.devze.com 2022-12-17 09:12 出处:网络
I am trying to find the find the Text of the Table cell (from TD) that is CLicked. Basically, my JQuery Code is not htting this line.

I am trying to find the find the Text of the Table cell (from TD) that is CLicked.

Basically, my JQuery Code is not htting this line.

$("#myTable tbody tr").find("td:eq(" + i + ")").click(function() {

My table has 88 Record开发者_C百科s when i tried $("#myTable tbody tr").length

But it is not find "td:eq(".

Appreciate all responses.


Did you mean $("#myTable tbody tr td").eq(i).click(function() { ? And $("#myTable td") is enough I think.


Try this:

$("#myTable tbody tr td").click(function(){
  var clickedCell = $(this);
  alert(clickedCell.text());
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号