jquery动态表单错误
我在遵循 本教程
这个简单的代码在 Firefox 3.5.5 中给我一个错误。
$(document).ready(function(){
$('#duplicate').dynamicForm('#plus', '#minus', {limit:5});
});
和错误:
"$("#duplicate").dynamicForm 不是函数"
HTML 中有一个 id="duplicate" 的元素,所以我不确定该错误意味着什么。
任何人都可以对这个问题发表一些见解吗?
I'm having trouble implementing this jQuery plugin for dynamic forms while following this tutorial
This simple code is giving me an error in Firefox 3.5.5.
$(document).ready(function(){
$('#duplicate').dynamicForm('#plus', '#minus', {limit:5});
});
and the error:
"$("#duplicate").dynamicForm is not a function"
There is an element in the HTML with id="duplicate" so I'm not sure what the error means.
Can anyone shed some insight on this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在包含
jquery
库本身之后,您是否在页面的head
部分中包含了jquery-dynamic-form.js
:Have you included
jquery-dynamic-form.js
in thehead
section of your page after the inclusion of thejquery
library itself:@buken你怎么知道两者都加载没有错误?
该错误表明没有为 jQuery 对象定义使用该名称的函数。当您尝试使用该插件时,该插件可能尚未正确加载。
尝试在 firebug 控制台中检查
$().dynamicForm
。如果加载插件,它应该输出normalizeElmnt(elmnt)
。检查从 http://code.google.com/p 下载的示例/jquery-dynamic-form/downloads/list,它有效还是抛出错误?@buken how do you know that both are loading with no errors?
That error says that there is no function defined with that name for jQuery object. Probably that plug-in has not loaded properly when you try to use it.
Try checking
$().dynamicForm
in firebug console. If plugin is loaded it should outputnormalizeElmnt(elmnt)
. Check with example downloaded from http://code.google.com/p/jquery-dynamic-form/downloads/list, does it work or throws error?经过几个小时的折腾,我终于解决了这个问题。罪魁祸首?脚本标记中的“text/javascript”拼写错误。
我想我现在要小睡一下了。感谢大家的帮助。
After many hours of hair-pulling, I've finally fixed the issue. The culprit? Misspelling "text/javascript" in the script tag.
I think I'll take a nap now. Thanks everyone for your help.