I'm implementing a bootstrap modal and need to change the functionality of the 'close' button (the small x in the upper right corner). I want that to call a javascript function instead of closing the modal . This is for a research project and not a production web site (I realize this would likely always be a bad idea on a live site).
Yeah, you just have to use the modal's 'hide' event. See the docs.
$("#exampleModal").on("hide.bs.modal", function(event){
event.preventDefault();
//do whatever here
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.