jquery scroll to specific div position in case of error and focus

后端 未结 2 489
天涯浪人
天涯浪人 2020-12-28 20:18

I have a hidden div with specific error messages throughout my form. Before form submit I run a validate routine to check if all the required fields are filled with some tex

2条回答
  •  灰色年华
    2020-12-28 20:40

    I don't think its gonna work out.

    Look at the code I left behind

    $('html, body').animate({
        scrollTop: ($('.error').first().offset().top)
    },500);
    

提交回复
热议问题