使用所有DOM操作函数处理表中的每条记录

时间:2015-01-29 05:15:21

标签: javascript jquery html dom

我尝试使用以下函数遍历表中的每个记录。它完美的工作。但问题是我只能使用html()函数。 jquery的其他DOM操作函数(如text(),val()或attr())不会给出任何结果。这有什么不对?

 $("#mprDetailDataTable tr:gt(0)").each(function () {
    var this_row = $(this); //select the row
    var record1= $.trim(this_row.find('td:eq(0)').html());//td:eq(0) means first td of this row
    var record2= $.trim(this_row.find('td:eq(1)').html());
    var record3= $.trim(this_row.find('td:eq(2)').html());
});

0 个答案:

没有答案