validform自定義提示效果


使用tiptype自定義提示效果

<form class="registerform" method="post" action="">
        <div class="form">
            <div class="field">
                <span>發票類型:</span>
                <label>增值稅專用發票</label>
            </div>
            <div class="field">
                <span>發票代碼:</span>
                <input type="text" class="fpdm" datatype="fd"/>
                <span class="Validform_checktip"></span>
            </div>
            <div class="field">
                <span>發票號碼起止:</span>
                <input type="text" class="fphm" datatype="lx" />
                <a href="###" class="add">+</a>
                <label>(格式:10000001-10000009)</label>
                <span class="Validform_checktip"></span>
            </div>
            <div class="fieldlh" >
            </div>
            <div class="field">
                <input type="submit" value="保存" class="czbtn save" />
                <input type="reset" value="重置" class="czbtn reset" />
            </div>
        </div>
</form>

js部分

$(function(){
           $(".registerform").Validform({
            btnSubmit:".save", 
            btnReset:".reset",
            tiptype:function(msg,o,cssctl){
                //msg:提示信息;
                //o:{obj:*,type:*,curform:*}, obj指向的是當前驗證的表單元素(或表單對象),type指示提示的狀態,值為1、2、3、4, 1:正在檢測/提交數據,2:通過驗證,3:驗證失敗,4:提示ignore狀態, curform為當前form對象;
                //cssctl:內置的提示信息樣式控制函數,該函數需傳入兩個參數:顯示提示信息的對象 和 當前提示的狀態(既形參o中的type);
                var objtip=o.obj.siblings(".Validform_checktip");
                cssctl(objtip,o.type);
                objtip.text(msg);
            }
        });
    });

如果tiptype插件自帶的1,2,3,4都不中用那就自己定義吧


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM