Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.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_Dom Traversal - Fatal编程技术网

Jquery遍历表(错误:不是函数)

Jquery遍历表(错误:不是函数),jquery,dom-traversal,Jquery,Dom Traversal,不能在td元素上使用.val(),它用于表单元素。try.text() 不能在td元素上使用.val(),它用于表单元素。try.text() 使用var num=$(this).closest('tr').find('td:first').html()取而代之 .val()用于输入元素,您希望获取要使用的HTML。使用var num=$(this).closest('tr')。find('td:first').HTML()取而代之 $(this).parent().parent().chil

不能在td元素上使用.val(),它用于表单元素。try.text()

不能在td元素上使用.val(),它用于表单元素。try.text()

使用
var num=$(this).closest('tr').find('td:first').html()取而代之

.val()
用于输入元素,您希望获取要使用的HTML。

使用
var num=$(this).closest('tr')。find('td:first').HTML()取而代之

$(this).parent().parent().children().first().text();

.val()
是用于输入元素的,您希望获取要使用的HTML

$(this).parent().parent().children().first().text();
您正在尝试调用
子函数的
first()
方法

您需要使用括号调用
children
函数

children.first()
您正在尝试调用
子函数的
first()
方法

您需要使用括号调用
children
函数

children.first()
试试这个

使用
html
而不是
val

试试这个


使用
html
而不是
val

Firebug说什么不是函数?真正的信息是什么?您是否记得包含jQuery?它正在工作:-您有一个额外的
.children().first()
,这是不需要的。Firebug说什么不是函数?真正的信息是什么?你记得要包括jQuery吗?它正在工作:-你有一个多余的
.children().first()
,这是不需要的。嗨,试过了:TypeError:$(…).parent(…).parent(…).children(…).children(…).first不是一个函数行3as@joe评论,一个parent().children(),编辑了我的答案。嗨,试过了:TypeError:$(…).parent(…).parent(…).children(…).first(…).children.first不是一个函数行3as@joe评论说,一个parent().children()太多了,编辑了我的答案,但你能解释一下为什么我的方式不起作用吗?阅读文档似乎做得很好…或者至少应该起作用..put.html()最后给了我同样的错误。也许是你在没有
()
的情况下编写了
.children
而将其转换为函数调用?你的方法可以工作,但你有一个太多的
.children().first()
选择器(再次,是
val()
而不是
html()
)。例如,这是有效的:
$(this).parent().parent().children().first().html();
哦,我明白了,我的遍历次数比需要的多了一次(以及()的错误)。谢谢!它可以工作,但是你能解释一下为什么我的方式不起作用吗?阅读文档似乎做得很好…或者至少应该可以工作。.puting.html()最后给了我同样的错误。也许是你在没有
()
的情况下编写了
.children
而将其转换为函数调用?你的方法可以工作,但你有一个太多的
.children().first()
选择器(再次,是
val()
而不是
html()
)。例如,这是有效的:
$(this).parent().parent().children().first().html();
哦,我明白了,我的遍历次数比需要的多了一次(以及()的错误)。谢谢!还有他使用了太多的
.children().first()
选择器。还有他使用了太多的
.children().first()
选择器。
$(this).closest('tr').find('td:first').html();