下面這代碼為什么會跳到當前頁面
<!DOCTYPE html>
<html xmlns="https://www.w3.org/1999/xhtml">
? ? <head>
? ? ? ? <title>表單驗證插件</title>
? ? ? ? <link href="style.css" rel="stylesheet" type="text/css" />
? ? ? ? <script type="text/javascript" src="http://idcbgp.cn/data/jquery-1.8.2.min.js"></script>
? ? ? ? <script type="text/javascript" src="http://idcbgp.cn/data/jquery.validate.js"></script>
? ? ? ? <script type="text/javascript" src="http://idcbgp.cn/data/jquery.validate.messages_cn.js"></script>
? ? </head>
? ? <body>
? ? ? ? <form id="frmV" method="get" action="#">
? ? ? ? ? ? <div id="divtest">
? ? ? ? ? ? ? ? <div class="title">
? ? ? ? ? ? ? ? ? ? <span class="fl">表單驗證插件</span>?
? ? ? ? ? ? ? ? ? ? <span class="fr">
? ? ? ? ? ? ? ? ? ? ? ? <input id="btnSubmit" type="submit" value="提交" />
? ? ? ? ? ? ? ? ? ? </span>
? ? ? ? ? ? ? ? </div>
? ? ? ? ? ? ? ? <div class="content">
? ? ? ? ? ? ? ? ? ? <span class="fl">郵箱:</span><br />
? ? ? ? ? ? ? ? ? ? <input id="email" name="email" type="text" /><br />
? ? ? ? ? ? ? ? ? ? <span class="tip"></span>
? ? ? ? ? ? ? ? </div>
? ? ? ? ? ? </div>
? ? ? ? </form>
? ? ? ??
? ? ? ? <script type="text/javascript">
? ? ? ? ? ? $(function () {
? ? ? ? ? ? ? ? $("#frmV").validate(
? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? /*自定義驗證規(guī)則*/
? ? ? ? ? ? ? ? ? ? ? rules: {
? ? ? ? ? ? ? ? ? ? ? ? ? ? email:{
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? required:true,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? email:true
? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? ? ? ? /*錯誤提示位置*/
? ? ? ? ? ? ? ? ? ? ? errorPlacement: function (error, element) {
? ? ? ? ? ? ? ? ? ? ? ? ? error.appendTo(".tip");
? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? );
? ? ? ? ? ? });
? ? ? ? </script>
? ? </body>
</html>
2019-04-09
改成上面這樣應該就行了
2019-02-28
我終于知道哪里錯了
你們看,這里多了一個右括號
2018-09-10
action這個屬性就是跳轉到某頁面的URL,只是這里沒填鏈接,填井號表示默認本頁面
2018-09-04
action="#", 這個#好像就是會跳到當前頁面