Microsoft JScript运行时错误:对象不支持属性或方法"validate" [英] Microsoft JScript runtime error: Object doesn't support property or method 'validate'
本文介绍了Microsoft JScript运行时错误:对象不支持属性或方法"validate"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此问题是我遇到错误,Microsoft JScript运行时错误:对象不支持属性或方法"validate".不知道为什么.有什么建议吗?
This issue is that i am getting the error, Microsoft JScript runtime error: Object doesn't support property or method 'validate'. Couldn't figure out why. Any suggestions?
<form id="ContactUs" class="float-left" autocomplete="off">
<div class="box-content">
<div id="Department-List" class="field clearfix">
<select id="DepartmentList" size="1" name="DepartmentList" class="required">
<% foreach(var options in (List<string>)ViewBag.DepartmentList) { %>
<option id="<%:options%>" value="<%:options%>" ><%:options%></option>
<% } %>
</select>
</div>
<div class="field clearfix">
<label class="float-left">NAME:</label>
<input type="text" id="Name" class="required full-width text radi-4" minlength="3"/>
</div>
<div class="field clearfix">
<label class="float-left">PHONE:</label>
<input type="text" id="Phone" class="required PhoneNumbers full-width text radi-4" />
</div>
<div class="field clearfix">
<label class="float-left">EMAIL:</label>
<input type="text" id="SendersEmail" class="required email full-width text radi-4"/>
</div>
<div class="field clearfix">
<label class="float-left">ACCOUNT #:</label>
<input type="text" id="AccountNumber" class="full-width text radi-4" />
</div>
<div class="field clearfix">
<label class="float-left">QUESTIONS:</label>
<textarea id="QuestionBox" rows="4" cols="25" class="required full-width text radi-4"></textarea>
</div>
<div class="field clearfix">
<input id="submit-inventory-request-button" type="submit" name="Submit" value="Send" class="submit next-step toggle-btn radi-3 arrow-icon" />
</div>
当我尝试提交表单时,我从$('#ContactUs').validate()函数获取错误.
When I am trying to submit the form I am getting the error from $('#ContactUs').validate() function.
<script type="text/javascript">
$(document).ready(function () {
$('#ContactUs').validate({
errorElement: 'span',
success: 'valid',
error: 'error',
submitHandler: function() {
var contact = {
DepartmentList: $('#DepartmentList').val()
, Name: $('#Name').val()
, Phone: $('#Phone').val()
, SendersEmail: $('#SendersEmail').val()
, RequestersEmail: $('#RequestersEmail').val()
, AccountNumber: $('#AccountNumber').val()
, QuestionBox: $('#QuestionBox').val()
, TermsCheckBox: $('#TermsCheckBox').val()
};
var req;
req = DT.ajaxData('/Ajax/ContactUs/', 'POST', JSON.stringify(contact));
// if the ajax request is successful, then display the success message and redirect the page
req.done(function(data) {
console.log(data);
$("#partial").dialog('close');
$("#SuccessMessage").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });
});
return false;
}
});
})
推荐答案
没有名为validate
的内置jQuery函数.它可以从几个插件中获得.例如
There is no built-in jQuery function named validate
. It's available from several plugins though. For example
您是否在页面中正确包含了插件的内容?
Have you properly included the plugin's in your page?
这篇关于Microsoft JScript运行时错误:对象不支持属性或方法"validate"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文