Created
April 8, 2015 19:00
-
-
Save billmei/2e9d11ff732b1ea6916f to your computer and use it in GitHub Desktop.
Display error messages to the user using a Bootstrap modal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="alert-modal" class="modal fade"> | |
<div class="modal-dialog"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
<h4 id="alert-modal-title" class="modal-title"></h4> | |
</div> | |
<div id="alert-modal-body" class="modal-body"></div> | |
<div class="modal-footer"> | |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | |
</div> | |
</div> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function alertModal(title, body) { | |
// Display error message to the user in a modal | |
$('#alert-modal-title').html(title); | |
$('#alert-modal-body').html(body); | |
$('#alert-modal').modal('show'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment