未捕获的类型错误:undefined不是函数(匿名函数)
Uncaught TypeError: undefined is not a function(anonymous function)
我正在尝试实现SimpleModal(http://www.ericmmartin.com/projects/simplemodal/)。然而,我遇到了一个奇怪的错误。我不能解决,但希望你们能解决。如果你能解释原因,那就太好了。
我做了一些调试。和https://example.com/scripts/sm.js正确且已加载。(与以下内容完全相同:https://simplemodal.googlecode.com/files/jquery.simplemodal-1.4.4.js)
$("body").append("<script type='"text/javascript'" src='"https://example.com/scripts/sm.js'"></script>");
$("body").append("<style>#basic-modal-content{display:none}#simplemodal-overlay{background-color:#000}#simplemodal-container{height:360px;width:600px;color:#bbb;background-color:#333;border:4px solid #444;padding:12px}#simplemodal-container .simplemodal-data{padding:8px}#simplemodal-container code{background:#141414;border-left:3px solid #65B43D;color:#bbb;display:block;font-size:12px;margin-bottom:12px;padding:4px 6px 6px}#simplemodal-container a{color:#ddd}#simplemodal-container a.modalCloseImg{background:url(../img/basic/x.png) no-repeat;width:25px;height:29px;display:inline;z-index:3200;position:absolute;top:-15px;right:-16px;cursor:pointer}#simplemodal-container h3{color:#84b8d9}</style>");
$("body").append("<div id='"basic-modal-content'"><h3>Basic Modal Dialog</h3><p>For this demo, SimpleModal is using this '"hidden'" data for its content. You can also populate the modal dialog with an AJAX response, standard HTML or DOM element(s).</p><p>Examples:</p><p><code>$('#basicModalContent').modal();// jQuery object - this demo</code></p><p><code>$.modal(document.getElementById('basicModalContent'));// DOM</code></p><p><code>$.modal('<p><b>HTML</b>elements</p>');// HTML</code></p><p><code>$('<div></div>').load('page.html').modal();// AJAX</code></p><p></p></div>");
$('#basic-modal-content').modal();
我做错了什么?
我猜这意味着modal不是一个函数,所以sm没有正确导入。如果你只是写一个常规的脚本标记而不是那个附加的呢?
相关文章:
- 为什么会出现错误;未捕获的类型错误:undefined不是函数;
- 为什么会出现错误,“UncaughtTypeError:undefined不是函数”
- mongoose.connect undefined不是一个函数
- Uncaught TypeError:undefined不是函数-ember js
- jQuery Mobile Undefined不是一个函数
- 未捕获的类型错误:undefined不是函数$
- 使用在函数外部声明的变量的 Javascript 返回值 + undefined
- 为什么Grunt Copy给了我一个'undefined不是函数'警告
- Bootstrap-“;未捕获的类型错误:undefined不是函数;
- Undefined不是函数ImpressPages DatePicker
- 尝试使用.ninnerHTMLlog打印数据,获取错误Uncaught TypeError:undefined不是函数
- 得到“;undefined不是函数“;错误
- Undefined不是Fullcalendar js上的函数
- 使用谷歌地图:一个返回undefined的自定义javascript函数
- jqGrid:undefined不是函数
- Jquery,Uncaught TypeError:undefined不是函数
- $http.post undefined 不是函数
- Ember cli Uncatch TypeError: undefined 不是函数
- Infragistics igGrid Uncatch TypeError: undefined 不是一个函数
- 如果构造函数在另一个函数中,则新创建的对象调用构造函数undefined