課程
/前端開(kāi)發(fā)
/jQuery
/jQuery插件——Validation Plugin
我把老師的視頻下載下來(lái),跟著視頻一起寫(xiě),怎么都不對(duì)
2016-06-26
源自:jQuery插件——Validation Plugin
正在回答
<script> ? ?$(document).ready(function(){ ? ? ? ?$("#demoForm").validate({ ? ? ? ? ? ?debug:true, ? ? ? ? ? ?rules:{ ? ? ? ? ? ? ? ?username:{ ? ? ? ? ? ? ? ? ? ?required:true, ? ? ? ? ? ? ? ? ? ?//minlength:2, ? ? ? ? ? ? ? ? ? // maxlength:10, ? ? ? ? ? ? ? ? ? ?rangelength:[2,10], ? ? ? ? ? ? ? ? ? ?remote:{ ? ? ? ? ? ? ? ? ? ? ? ?url:"remote.json", ? ? ? ? ? ? ? ? ? ? ? ?type:"post", ? ? ? ? ? ? ? ? ? ? ? ?data:{ ? ? ? ? ? ? ? ? ? ? ? ? ? ?loginTime:function(){ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?return +new Date; ? ? ? ? ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ?}, ? ? ? ? ? ? ? ?password:{ ? ? ? ? ? ? ? ? ? ?required:true, ? ? ? ? ? ? ? ? ? ?minlength:2, ? ? ? ? ? ? ? ? ? ?maxlength:16, ? ? ? ? ? ? ? ?}, ? ? ? ? ? ?}, ? ? ? ? ? ?message:{ ? ? ? ? ? ? ? ?username:{ ? ? ? ? ? ? ? ? ? ?required:"必須填寫(xiě)用戶(hù)名", ? ? ? ? ? ? ? ? ? ?minlength:"必須填寫(xiě)至少2位", ? ? ? ? ? ? ? ? ? ?maxlength:"必須填寫(xiě)用戶(hù)名至少10位" ? ? ? ? ? ? ? ?}, ? ? ? ? ? ? ? ?password:{ ? ? ? ? ? ? ? ? ? ?required:"必須填寫(xiě)密碼", ? ? ? ? ? ? ? ? ? ?minlength:2, ? ? ? ? ? ? ? ? ? ?maxlength:16, ? ? ? ? ? ? ? ?}, ? ? ? ? ? ?}, ? ? ? ?}); ? ?});</script>
舉報(bào)
validation讓客戶(hù)端表單驗(yàn)證變?nèi)菀?,縮短用戶(hù)等待時(shí)間
1 回答為什么寫(xiě)的required校驗(yàn)規(guī)則沒(méi)有反應(yīng)
1 回答remote遠(yuǎn)程驗(yàn)證,chrome報(bào)錯(cuò)
2 回答這個(gè)表單驗(yàn)證有代碼嗎
1 回答一定要在控制臺(tái)寫(xiě)代碼嗎?我在源代碼中寫(xiě)的用不了啊
1 回答無(wú)法實(shí)現(xiàn)自動(dòng)校驗(yàn)
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢(xún)優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2016-08-05
<script>
? ?$(document).ready(function(){
? ? ? ?$("#demoForm").validate({
? ? ? ? ? ?debug:true,
? ? ? ? ? ?rules:{
? ? ? ? ? ? ? ?username:{
? ? ? ? ? ? ? ? ? ?required:true,
? ? ? ? ? ? ? ? ? ?//minlength:2,
? ? ? ? ? ? ? ? ? // maxlength:10,
? ? ? ? ? ? ? ? ? ?rangelength:[2,10],
? ? ? ? ? ? ? ? ? ?remote:{
? ? ? ? ? ? ? ? ? ? ? ?url:"remote.json",
? ? ? ? ? ? ? ? ? ? ? ?type:"post",
? ? ? ? ? ? ? ? ? ? ? ?data:{
? ? ? ? ? ? ? ? ? ? ? ? ? ?loginTime:function(){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?return +new Date;
? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ?},
? ? ? ? ? ? ? ?password:{
? ? ? ? ? ? ? ? ? ?required:true,
? ? ? ? ? ? ? ? ? ?minlength:2,
? ? ? ? ? ? ? ? ? ?maxlength:16,
? ? ? ? ? ? ? ?},
? ? ? ? ? ?},
? ? ? ? ? ?message:{
? ? ? ? ? ? ? ?username:{
? ? ? ? ? ? ? ? ? ?required:"必須填寫(xiě)用戶(hù)名",
? ? ? ? ? ? ? ? ? ?minlength:"必須填寫(xiě)至少2位",
? ? ? ? ? ? ? ? ? ?maxlength:"必須填寫(xiě)用戶(hù)名至少10位"
? ? ? ? ? ? ? ?},
? ? ? ? ? ? ? ?password:{
? ? ? ? ? ? ? ? ? ?required:"必須填寫(xiě)密碼",
? ? ? ? ? ? ? ? ? ?minlength:2,
? ? ? ? ? ? ? ? ? ?maxlength:16,
? ? ? ? ? ? ? ?},
? ? ? ? ? ?},
? ? ? ?});
? ?});
</script>