请教一个关于validform 表单验证的问题

关于自定义验证错误信息以弹出框的方式显示

相关代码:
<form id="addaddress-form">
    <div class="m-cell">
        <div class="cell-item">
            <div class="cell-left">收件人:</div>
            <div class="cell-right">
                <input type="text" name="uname" class="cell-input" datatype="*" placeholder="请输入收件人姓名" >
            </div>
        </div>
        <div class="cell-item">
            <div class="cell-left">手机号码:</div>
            <div class="cell-right">
                <input type="number" name="uphone" pattern="[0-9]*" datatype="*" class="cell-input" placeholder="请输入手机号" 
                />
            </div>
        </div>
        <div class="cell-item">
            <div class="cell-left">收件地址:</div>
            <div class="cell-right">
                <input type="text" name="uaddress" class="cell-input cell-arrow" datatype="*" placeholder="省/市/区">
            </div>
        </div>
        <div class="cell-item">
            <div class="cell-left">详细地址:</div>
            <div class="cell-right">
                <input type="text" name="udetailedaddress" class="cell-input" datatype="*" placeholder="请输入详细收货地址">
            </div>
        </div>
    </div>
    <div class="pd20">
        <button type="button" class="btn-block btn-fcx j-save">保存配送地址</a>
    </div>
</form>
$(function () {
    // var dialog = window.YDUI.dialog;
    var addaddressForm = $('#addaddress-form').Validform({
        btnSubmit: '.j-save',
        tiptype: function (msg, o, cssctl) {
            if (o.type !== 2) {
                //dialog.toast(msg, 'error', 1000, function () {});
            } else {
                return false;
            }
        },
        tipSweep: true,
        showAllError: false,
        beforeSubmit: function (curform) {
            console.log(curform)
            return false;
        }
    });
});

问题在于,提示了错误信息后,当前验证的那个input框会自动获取焦点。 我想取消掉,验证不通过的不自动获取到焦点上。

拜托!-_- !找了文档也没有找到相应的参数。!

阅读 2k
1 个回答

驗証完後調用 document.activeElement.blur();

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题