11智能在线
新记
jquery 遍历表格,需要表格中每个td的内容
想把这个表格每行的数据整理成json,然后push到一个数组中,这表格怎么遍历能够得到每个td的值呢?
举报该文章
相关建议 2014-02-19
$("table tr:gt(0)").each(function(i){
alert("这是第"+i+"行内容");
$(this).children("td").each(function(i){
alert("第"+i+"个td的内容:"+$(this).text());
});
});
温馨提示:内容为网友见解,仅供参考
当前网址:
https://11.t2y.org/zz/22ppp8mm72mpvqfvmp.html
其他看法
第1个回答 2017-06-17
$('td').each(function(){
arr[$(this).index()] = $(this).val();
})
相似回答
大家正在搜
相关问题
js或者jquery取出td里面的数据,td里面数据是遍历出...
jQuery怎么遍历表格,获取每一列的值
页面上有个<table>表格,如何用JS中的循环分别取得各个...
jquery怎么循环取表格中每个文本框的值
我有一个表格,需要用jquery循环遍历里面所有文本框的内容...
jQuery怎么获取某表格中的一列td的值?
jQuery怎么获取某表格中的一列td的值
js或jQuery如何获取点击的td表格的内容