Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.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
Jquery 访问元素的文本时出现问题_Jquery - Fatal编程技术网

Jquery 访问元素的文本时出现问题

Jquery 访问元素的文本时出现问题,jquery,Jquery,HTML: 返回一个bunch函数和jquery代码。可能来自jquery.min。这里出了什么问题?您正在访问实际的函数,而不是执行它。(.text是一个函数,而不是一个变量,因此需要执行它来获取其返回值.text()) <table> <tr> <td>wddsa</td> <td>dffs</td> </tr> </table> $('tbody tr').each(f

HTML:


返回一个bunch函数和jquery代码。可能来自jquery.min。这里出了什么问题?

您正在访问实际的函数,而不是执行它。(
.text
是一个函数,而不是一个变量,因此需要执行它来获取其返回值
.text()

<table>
  <tr>
    <td>wddsa</td>
    <td>dffs</td>
  </tr>
</table>
$('tbody tr').each(function() {
    name2 = $(this).children("td:first").text;
    alert(name2);
});
name2 = $(this).children("td:first").text();