为什么我在下面的代码中遇到JavaScript错误 [英] Why do I get JavaScript error for the following code below
本文介绍了为什么我在下面的代码中遇到JavaScript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<script>
$(function () {
$("#menu").menu();
});
</script>
Unhandled exception at line 195, column 10 in http://localhost:51508/Index.aspx
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'menu'
If there is a handler for this exception, the program may be safely continued.
//我已经包含了所有的JQuery库。在Visual Studio 2013下运行
// I have included all the JQuery libraries. Running under Visual Studio 2013
推荐答案
(function(){
(function () {
(#menu)。menu();
});
< / script >
("#menu").menu(); }); </script>
Unhandled exception at line 195, column 10 in http://localhost:51508/Index.aspx
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'menu'
If there is a handler for this exception, the program may be safely continued.
//我已经包含了所有的JQuery库。在Visual Studio 2013下运行
// I have included all the JQuery libraries. Running under Visual Studio 2013
您尝试使用的对象没有menu
属性。这不是编程工作的方式。
查看此代码示例,它确实有效: https ://jqueryui.com/menu [ ^ ]。确保包含jQuery-UI脚本,而不仅仅是jQuery。
-SA
There is no such thing asmenu
property for the object you are trying to use. This is not how programming work.
Check with this code sample, which really works: https://jqueryui.com/menu[^]. Make sure you include the jQuery-UI script, not just jQuery.
—SA
这篇关于为什么我在下面的代码中遇到JavaScript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文