twitter-bootstrap 未捕获的类型错误:未定义不是数据表的函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23295424/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Uncaught TypeError: undefined is not a function for datatables
提问by Muhammad Usman
I am working in ASP .NET MVC4. When jquery is loaded then I got an error Undefined is not a functionby using jquery.

我在 ASP .NET MVC4 中工作。当加载 jquery 时,我Undefined is not a function使用 jquery出现错误。

In HTML version its working correctly but when it loaded through compiler it is not working correctly.
在 HTML 版本中,它可以正常工作,但是当它通过编译器加载时,它无法正常工作。
采纳答案by Muhammad Usman
Sorry I am answering my own question I got error for this question it is just rearranging file sequence in file loading Thanks to all who give me time to solve my problem
对不起,我正在回答我自己的问题我在这个问题上出错了它只是在文件加载中重新排列文件序列感谢所有给我时间解决我的问题的人
回答by bajuwa
I think the problem is constructor DataTable(), It is supposed to be capitalized.
Instead of $('#dt_inbox').dataTable()use $('#dt_inbox').DataTable()
我认为问题是构造函数DataTable(),它应该大写。
而不是$('#dt_inbox').dataTable()使用$('#dt_inbox').DataTable()
回答by Api
Well if you are using AMD pattern, you would need to keep your module name to "datatables" so that you don't get "Uncaught TypeError: jQuery(...).DataTable is not a function"
好吧,如果您使用的是 AMD 模式,则需要将模块名称保留为“datatables”,以免出现“Uncaught TypeError: jQuery(...).DataTable is not a function”
Below link was helpful. https://datatables.net/forums/discussion/21178/amd-definition-without-explicit-module-name
下面的链接很有帮助。 https://datatables.net/forums/discussion/21178/amd-definition-without-explicit-module-name
回答by kregus
I was struggling with the same problem for hours.. My issue was resolved when I changed the $to jQueryin my code.
我用了好几个小时了同样的问题挣扎..当我改变了我的问题就解决了$,以jQuery我的代码。
回答by Stepan Riha
You problably forgot to add the plugin to your bundle. The following questions goes into more details:
您可能忘记将插件添加到您的包中。以下问题更详细:

