Skip to content Skip to sidebar Skip to footer

How To Show Flash Messages In Bootstrap Modal Window?

Here is the problem. I have a bootstrap modal window with forms where i show up error messages with flask.flash() if any happend. But! When I click upload for the first time my mod

Solution 1:

Yeah, I was stuck with this too. There is a easy solution with JQuery: This code basically opens up the modal only if the error (flash warning exist)

where .flash is the div that you named for your flash warning and

changePasswordModal is the modal ID

<script>
    $(document).ready(function() { // When page finished loadingif ( $('.flash').length ) { // if there is an DOM that has class has-error
     $('#changePasswordModal').modal('show'); // Show Modal
  }
});
</script>

Post a Comment for "How To Show Flash Messages In Bootstrap Modal Window?"