Created
August 25, 2016 13:14
-
-
Save Pamblam/17578858ea1028970a9e8f0da7da5829 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* A disposable alert modal that uses Bootstrap | |
* https://jsfiddle.net/s9ojmwwt/2/ | |
*/ | |
function BSAlert(text){ | |
var mid = "modal"+Math.floor(Math.random() * 10000000000000001); | |
var html = '<div class="modal fade" id="'+mid+'" tabindex="-1"'+ | |
'role="dialog" aria-labelledby="myModalLabel" aria-hidden='+ | |
'"true"><div class="modal-dialog"><div class="modal-conten'+ | |
't"><div class="modal-header"><button type="button" class='+ | |
'"close" data-dismiss="modal" aria-label="Close"><span ari'+ | |
'a-hidden="true">×</span></button><h4 class="modal-t'+ | |
'itle" id="myModalLabel"> </h4></div><div class="modal'+ | |
'-body">'+text+'</div><div class="modal-footer"><button t'+ | |
'ype="button" class="btn btn-primary">Ok</button></div></d'+ | |
'iv></div></div>'; | |
$('body').append(html); | |
$("#"+mid).find('button').click(function(){ | |
$("#"+mid).remove(); | |
}); $("#"+mid).modal('show'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment