Scroll at the top of bootstrap modal

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.

Answers 1
  • Scroll at the top of bootstrap modal

    $("#modal").scrollTop(0);
    
    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