Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.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 jquery循环问题_Javascript_Jquery_Dom - Fatal编程技术网

Javascript jquery循环问题

Javascript jquery循环问题,javascript,jquery,dom,Javascript,Jquery,Dom,我在页面上给定的每个循环中。我如何在$this内循环所有,即在当前: 但是,如果您不需要在tr上执行任何操作,或者可以链接它们,则可以更简洁地执行此操作 $(this).find('th').each(...) 或 您可以在原始循环中执行此操作: $('#my_table > tbody > tr > th').each(function() { 但是,如果由于某种原因无法执行此操作,例如循环中存在其他代码,则可以使用以下方法: $('th',this).each(func

我在页面上给定的每个循环中。我如何在$this内循环所有,即在当前:

但是,如果您不需要在tr上执行任何操作,或者可以链接它们,则可以更简洁地执行此操作

$(this).find('th').each(...)


您可以在原始循环中执行此操作:

$('#my_table > tbody > tr > th').each(function() {
但是,如果由于某种原因无法执行此操作,例如循环中存在其他代码,则可以使用以下方法:

$('th',this).each(function() {
过滤器将从当前选择器中删除任何不是th的元素,而不是获取th的子元素
$(this).find('th').each(...)
$('th', this).each(...)
$('#my_table > tbody > tr > th').each(function() {
$('th',this).each(function() {