Scroll at the top of bootstrap modal

Updated at 20-Sep-2021, By samar

Scroll at the top of bootstrap modal

In this session, we’ll try our hand at solving the "Scroll at the top of bootstrap modal" puzzle by using the computer language.

Sometimes you have to scroll at the top of bootstrap modal to display the errors message for input fields of form and display the success message as ajax response on ajax call at the top of modal.
  • Scroll at the top of bootstrap modal

    $("#modal").scrollTop(0);
    

    You have to pass the modal id to scrollTop method. You can use this code snippet on button click, on form submit and also getting response of ajax call. It will scroll to at the top of the modal.

Back to code snippet queries related bootstrap