jquery 逐行遍历table
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jquery 逐行遍历table相关的知识,希望对你有一定的参考价值。
菜鸟求助。有一个table,每一行tr为一个对象,现在需要遍历每一行的tr封装为一个对象,要怎么写JS,最好是jQuery,谢谢
参考技术A var obj = ;Array.prototype.forEach.call($('table tr'), function(tr , index)
obj['tr' + index] = tr;
);
console.dir(obj); 参考技术B $("table tr");
不懂jquery最基础的选择器吗? 参考技术C $('table tr').each(function());本回答被提问者采纳 参考技术D var table = document.getElementById("tableid"); var rows = table.rows;
for(var i = 0;i<rows.length;i++)
//TODO
第5个回答 2013-12-24 $('table tr').click(function(event)
/* Act on the event */
console.log($(this));
);
这样就取出tr了
以上是关于jquery 逐行遍历table的主要内容,如果未能解决你的问题,请参考以下文章