Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 警报表数据_Javascript_Jquery - Fatal编程技术网

Javascript 警报表数据

Javascript 警报表数据,javascript,jquery,Javascript,Jquery,如何在单击id:key时向TableData发出警报 $('#sampleTbl tr').each(function(row, tr){ TableData = TableData + $(tr).find('td:eq(0)').text() + ' ' // Task No. + $(tr).find('td:eq(1)').text() + ' ' // Date + $(tr).find('t

如何在单击id:key时向TableData发出警报

$('#sampleTbl tr').each(function(row, tr){
        TableData = TableData 
            + $(tr).find('td:eq(0)').text() + ' '  // Task No.
            + $(tr).find('td:eq(1)').text() + ' '  // Date
            + $(tr).find('td:eq(2)').text() + ' '  // Description
            + $(tr).find('td:eq(3)').text() + ' '  // Task
            + '\n';
    });
我只是想知道它是否得到了这些tr.

中的文本

//insert this code within each function:
if (!$(this).text().trim().length) {
        //do the stuff here
    }

你能提供提琴吗???另外,你应该返回表格数据。
$('#sampleTbl tr').each(function(row, tr){
        TableData = TableData 
            + $( this ).find('td:eq(0)').text() + ' '  // Task No.
            + $( this ).find('td:eq(1)').text() + ' '  // Date
            + $( this ).find('td:eq(2)').text() + ' '  // Description
            + $( this ).find('td:eq(3)').text() + ' '  // Task
            + '\n';
    });