jQuery – Bind events to opening and closing a Bootstrap modal

print
Cause an event to be triggered when opening and closing a Bootstrap (3+) modal window.

Modal Close:

$('#myModal').on('hidden.bs.modal', function () {
   // do something here
})

Modal Open:

$('#myModal').on('shown.bs.modal', function () {
   // do something here
})

 

Share this post:
Related Posts
Disable and enable buttons (Bootstrap) using a jQuery extension
Getting the value or text of an HTML attribute using jQuery
1 Comment
  • Fluffy
    Sep 4,2018 at 8:29 pm

    I have to add my own comment here to say that this post is potentially the laziest post ever written. I know I use this site to jot things down, but i think this is just taking the biscuit 🙁

Leave a Comment