Skip to content

Instantly share code, notes, and snippets.

@randika
Created August 3, 2016 01:03
Show Gist options
  • Save randika/07380b459a50e2ce30eeec2d1ab87dca to your computer and use it in GitHub Desktop.
Save randika/07380b459a50e2ce30eeec2d1ab87dca to your computer and use it in GitHub Desktop.
<html>
<head>
<!-- modal dialog error handling -->
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"
></script>
<script type='text/javascript' >
window.alert = function(message){
$('#sc-model-dialog .modal-body p').html(message);
$('#sc-model-dialog').modal('show');
}
// (function(proxied) {
// window.alert = function(message) {
// $('#sc-model-dialog .modal-body p').html(message);
// $('#sc-model-dialog').modal('show');
// return proxied.apply(this, arguments);
// };
// })(window.alert);
function validate() {
alert("I'm a window.alert()");
console.log("You should see me, only after you close the modal")
}
</script>
</head>
<body>
<a href="#" onClick="validate();">Click</a>
<!-- HTML modal -->
<div class="modal fade" id="sc-model-dialog" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Error</h4>
</div>
<div class="modal-body">
<p></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment