Sunday, December 25, 2016
Custom JavaScript Alert Box with modernAlert js
Custom JavaScript Alert Box with modernAlert js

These popup boxes look different in every web browser along with their ugly appearance.
As I mentioned already that we cannot achieve exact duplicate of these functions but we can have something similar to it.
I wrote a pure JavaScript function, which can replace these native functions. And we can customize the appearance as well.
modernAlert.js is a small, Lightweight Library to override native JavaScript functions: Alert, Confirm and prompt. It provides customizable HTML popup instead of browser-based popup, which can be styled using number of arguments and traditional way of using CSS.
How to use it:
Download the script from https://github.com/5um17/modernAlert and follow the readme.md instructions to use it in your project.
Examples:
- Example of Alert box
Alert<a class="scg-button" href="#" onclick="alert(This is example of Alert, Simple Alert); return false;">Alert</a>
- Example of Confirm box
Confirm<a class="scg-button" onclick="confirm(Example of confirm box, Simple Confirm, function(input){var str = input === true ? Ok : Cancel; alert(You clicked + str, Simple Alert);}); return false;" href="#">Confirm</a>
- Example of Prompt box
Prompt<a class="scg-button" onclick="prompt(Example of Prompt, Simple Prompt, function(input){alert(You entered + input, Simple Alert);}); return false;" href="#">Prompt</a>/code>
For queries and suggestions you can comment here. For reporting issues and contributing to the code please use GitHub repository https://github.com/5um17/modernAlert
Available link for download
Labels:
alert,
box,
custom,
javascript,
js,
modernalert,
with