本文介绍了未捕获的TypeError:elem.nodeName.toLowerCase不是函数Jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在做一个工作正常的项目,但是今天突然出现了TypeError
i am working on a project which was working fine but suddenly today it is showing an TypeError
下面是我得到错误的代码
below is my code where i got the error
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
// Do not set data on non-element because it will not be cleared (#8335).
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
return false;
}
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase()//**here** ];
我稍稍更改了代码,并在toLowerCase之前将其添加到String,但仍然遇到相同的错误,
I changed my code a bit and added toStringbefore toLowerCase but still getting the same error,
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toString().toLowerCase()//**like this** ];
这里可能出什么问题?
推荐答案
基于Nakama Hiroshi的回答.我发现了错误.在输入中添加了名称"nodeName".
Base on Nakama Hiroshi's answer.I found my mistake.I add name "nodeName" for the input.
<input type="text" id="nodeName" name="nodeName" />
然后将"nodeName"更改为其他名称.然后解决问题
And I change "nodeName" to other name. Then fix the problem
这篇关于未捕获的TypeError:elem.nodeName.toLowerCase不是函数Jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!