Overriding default alert()
See it in action: JS Alert Demo
Add this code after js-alert.js
// Setting options
alert.options = {
'bootstrap': false // true if you use Bootstrap
};
Then you can call alert() at anytime as:
$(function (){
$('#jsalert').on('click', function (e){
e.preventDefault();
alert($('#alert_message').val());
});
});
In this example, I am using Bootstrap for CSS