如何使验证自动滚动到第一个错误在顶部顺利但不跳到第一个无效错误? [英] How to make validation auto scroll to first error on top smoothly but not jumping to the first invalid error?

查看:85
本文介绍了如何使验证自动滚动到第一个错误在顶部顺利但不跳到第一个无效错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过的是这个,但它不起作用滚动仍然跳到无效的错误验证。另外我使用表单类型甚至选择选项,它似乎无法正常工作直接跳转到无效的文本字段,但我想要的是顺利滚动到无效的文本字段并选择选项。请帮帮我。



我在谷歌尝试了很多例子,但似乎都无法工作。



我尝试过:



What I have try is this but it doesn't work the scroll still jump up to the invalid error validation. Plus I use types of forms even select option and it seems can't work it straight jump to the invalid text field, but what I want is smoothly scroll up to invalid text field and select option. Please help me with this.

I have try many example in google but all can't seems to work.

What I have tried:

$(document).ready(function () {
$('#submit').click(function(){
    $('html,body').animate({scrollTop: 0},800);
    return false;
  });
});

推荐答案

(document).ready(function(){
(document).ready(function () {


('#submit')。click(function(){
('#submit').click(function(){


('html,body')。animate({scrollTop:0},800);
返回false;
});
});
('html,body').animate({scrollTop: 0},800); return false; }); });


这篇关于如何使验证自动滚动到第一个错误在顶部顺利但不跳到第一个无效错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆