jquery动态表单错误

发布于 2024-08-12 21:46:38 字数 463 浏览 13 评论 0原文

我在遵循 本教程

这个简单的代码在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

忆梦 2024-08-19 21:46:38

在包含 jquery 库本身之后,您是否在页面的 head 部分中包含了 jquery-dynamic-form.js

<script type="text/javascript" src="jquery.js"></script>    
<script type="text/javascript" src="jquery-dynamic-form.js"></script>

Have you included jquery-dynamic-form.js in the head section of your page after the inclusion of the jquery library itself:

<script type="text/javascript" src="jquery.js"></script>    
<script type="text/javascript" src="jquery-dynamic-form.js"></script>
笑叹一世浮沉 2024-08-19 21:46:38

@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 output normalizeElmnt(elmnt). Check with example downloaded from http://code.google.com/p/jquery-dynamic-form/downloads/list, does it work or throws error?

中性美 2024-08-19 21:46:38

经过几个小时的折腾,我终于解决了这个问题。罪魁祸首?脚本标记中的“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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文