亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

類型錯誤:$(...).validate 不是函數

類型錯誤:$(...).validate 不是函數

慕哥9229398 2021-12-02 16:36:24
我正在創建一個登錄頁面,但我不確定為什么沒有加載驗證腳本。昨天我能夠登錄而沒有像這樣的錯誤。但是,當我今天嘗試登錄時,遇到了此錯誤。這是我的腳本的位置嗎?我試過重新排列腳本,并檢查其他文件,例如我的 js 和 jquery.validate.min.js 的文件位置,但一切似乎都很好。.html<meta http-equiv="content-type" content="text/html; charset=UTF-8" /><!--<meta http-equiv="refresh" content="5">--><!--<meta http-equiv="X-UA-Compatible" content="IE=edge" />--><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"><link rel="stylesheet" type="text/css" href="css/index.css"><link rel="stylesheet" href="https://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" /><script src="https://code.jquery.com/jquery-1.9.1.js"></script><script src="https://code.jquery.com/ui/1.10.2/jquery-ui.js"></script><link href="../Content/bootstrap.min.css" rel="stylesheet" /><script src="lib/jquery.validate.min.js"></script><!--<link href="css/jquery.mobile-1.4.5.min.css" rel="stylesheet" />--><script src="scripts/common.js"></script>.JSvar userid;var password; $(document).ready (function () {    $("#LoginForm").validate({   // this line is the error highlighted in console        messages: {            txtLogin: "User ID is required",            txtPassword: "Password is required",        },我相信我應該能夠在解決這個問題后登錄,因為我已經正確配置了我的 PHP 和其他文件。JS 文件似乎也不錯。
查看完整描述

1 回答

?
ITMISS

TA貢獻1871條經驗 獲得超8個贊

為了使用 的validation方法jQuery,您需要導入相關插件:


<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>

此外,在您的 JavaScript 文件的開頭插入:


require('jquery-validation');

例如:


<form>

    <input required>

</form>

<script src="jquery.js"></script>

<script src="jquery.validate.js"></script>

<script>

    $("form").validate();

</script>

有關更多信息,請參閱官方文檔。


查看完整回答
反對 回復 2021-12-02
  • 1 回答
  • 0 關注
  • 382 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號