How to access table cells from jquery
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
精彩评论