How to Create a Scroll To Top With Some Delay Using JavaScript ?

JavaScript scroll to top tutorial image

Here I am sharing the code for scrolling a page from bottom to top with some delay. You can also use that to reach or show first error element box in your specified form.  Show First Scrolled Error Element Box on Submit :- you can use below jQuery code to scroll on the first error element box on submit – $(‘html, body’).animate({ scrollTop: $(validator.errorList[0].element).offset().top-300 }, 2000); Above code will work for the form group on submit. for an example below – $(“#submit”).on(‘click’, function () { var validator = $(“#form”).validate({ rules:…