开发者

How to access table cells from jquery

开发者 https://www.devze.com 2022-12-23 13:53 出处:网络
Ok, I have a table which contains multiple rows. Each row contains some data and a hyperlink. When this link is clicked, I need to open up jquery\'s dialog form and let the user able to edit the data

Ok, I have a table which contains multiple rows. Each row contains some data and a hyperlink. When this link is clicked, I need to open up jquery's dialog form and let the user able to edit the data of the corresponding rows. So when the lin开发者_如何学编程k is clicked, I need to access the values of the corresponding row cells from jquery.

How can I do that ?


Basic structure:

$("#tableId a").click(function() {
  var row = $(this).closest("tr");
  ...
  return false;
});

Inside that you can then access cells most easily by giving marker classes to your cells and then doing things like:

var total = row.children("td.total");

assuming a class of total.


cletus is right... but if you're just up to editing data cell, might as well use Jeditable

0

精彩评论

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