Cheetah 模板上未找到 JQuery 插件功能
我正在尝试为一个网站制作一个评论表单,允许用户在作为猎豹模板的 html 文件上留下他们的姓名、电子邮件和评论。我想使用这个 JQuery 插件来验证输入: http://docs.jquery.com/Plugins/validation< /a>
我可以使用演示代码让该函数在自己的文件中工作,但是当我尝试将其应用到 cheetah 模板时,Firebug 给出以下错误:
$("#feedbackform").validate is not a function
[Break On This Error] $("#feedbackform").validate();
我将 cheetah 变量设置为“@”以适应对 JQuery 使用“$”,然后调用该函数,如下所示:
#compiler-settings
cheetahVarStartToken=@
#end compiler-settings
<script type="text/javascript">
$(document).ready(function(){
$("#feedbackform").validate();
});
</script>
#compiler-settings reset
以下是表单的代码:
<form id="feedbackform" action="leavefeedback.html" method="GET">
<table cellpadding="8" style="width:600px;"><tr>
<td valign="top" align="right" >Name</td>
<td><input type="text" id="fname" name="name" class="required" minlength="2" size="30"></td></tr>
<tr><td valign="top" align="right" >Email</td>
<td><input type="text" id="femail" name="email" class="required email" size="30"></td></tr>
<tr><td valign="top" align="right" style="width:100px" >Comment</td><td>
<textarea name="feedback" id="fcomment" class="required" rows="10" style="width:400px;"></textarea>
<input class="submit" type="submit" name="submit" value="Submit"></td></tr>
</table>
</form>
任何建议或帮助将不胜感激。谢谢!
I am trying to make a comment form for a website that allows users to leave their name, email, and a comment on an html file that is a cheetah template. I want to use this JQuery plugin to validate input: http://docs.jquery.com/Plugins/validation
I can get the function to work in its own file using the demo code, but when I try to apply it to the cheetah template, Firebug gives me the following error:
$("#feedbackform").validate is not a function
[Break On This Error] $("#feedbackform").validate();
I am setting the cheetah variable to '@' to accommodate use of '$' for JQuery, then calling the function, as follows:
#compiler-settings
cheetahVarStartToken=@
#end compiler-settings
<script type="text/javascript">
$(document).ready(function(){
$("#feedbackform").validate();
});
</script>
#compiler-settings reset
Here is the code for the form:
<form id="feedbackform" action="leavefeedback.html" method="GET">
<table cellpadding="8" style="width:600px;"><tr>
<td valign="top" align="right" >Name</td>
<td><input type="text" id="fname" name="name" class="required" minlength="2" size="30"></td></tr>
<tr><td valign="top" align="right" >Email</td>
<td><input type="text" id="femail" name="email" class="required email" size="30"></td></tr>
<tr><td valign="top" align="right" style="width:100px" >Comment</td><td>
<textarea name="feedback" id="fcomment" class="required" rows="10" style="width:400px;"></textarea>
<input class="submit" type="submit" name="submit" value="Submit"></td></tr>
</table>
</form>
Any suggestions or help would be greatly appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论