Introduction
JavaScript is a programming language whereas jQuery is a framework to help make writing in JavaScript easier. It's particularly useful for simply traversing the DOM in an HTML page. jQuery was written using JavaScript, and is a library to be used by JavaScript.
Top most used notification libraries and plugins for JavaScript and jQuery -
- Normal JavaScript
- Bootbox
- Noty
- Toastr
- AmaranJS
- Notific8
- Notie.js
- iziToast
- VEX
- Sweet Alert
- Alertify.js
- ohSnap!
Description
I have collected the list of the most useful and beautiful notification plugins in JavaScript and jQuery for ASP.NET web applications.
Project Solution File Download Link
Click Here>>
Steps to be followed
Create an MVC web application named "SatyaprakashTop10Javascript".
1. Normal notification library and plugin.
This library is used for normal notification purposes as it was used in earlier projects.
I created a Controller class file named "HomeController.cs". Inside, I created one action result method named "Normal()".
- public ActionResult Normal()
- {
- return View();
- }
Using that, I created one View named "Normal.cshtml". Here, I used some script and css.
By using solution file, you can see details about the codes. I have just described the most major part.
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
- alert("User Name Should Not Be Empty !!");
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
- alert("Password Should Not Be Empty !!");
- }
- else {
- alert("Registration Successful.");
- }
- });
- });
- </script>
OUTPUT
If isername and password fields are empty.
If both inputs are valid.
2. Bootbox notification library and plugin.
Bootbox.js is a small JavaScript library which allows you to create programmatic dialog boxes using Bootstrap modals, without having to worry about creating, managing, or removing any of the required DOM elements or JS event handlers.
In HomeController.cs,
- public ActionResult Bootbox()
- {
- return View();
- }
In Bootbox.cshtml,
- In Bootbox.cshtml :
-
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
- bootbox.alert("User Name Should Not Be Empty !!");
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
- bootbox.alert("Password Should Not Be Empty !!");
- }
- else
- {
- bootbox.alert("Registration Successful.");
- }
- });
- });
- </script>
OUTPUT
If Username and Password fields are empty.
If both inputs are valid.
3. toastr notification library and plugin.
Toastr is a jQuery plugin, the goal is to create a simple core library that can be easily customized and extended.
The notifications are non-blocking, the position, animation and theme are customizable.
In HomeController.cs,
- public ActionResult toastr()
- {
- return View();
- }
In toastr.cshtml,
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
- toastr.warning('User Name Should Not Be Empty !!')
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
- toastr.warning('Password Should Not Be Empty !!')
- }
- else {
- toastr.success('Registration Successful.')
- }
- });
- });
- </script>
OUTPUT
If Username and Password fields are empty.
If both Inputs are Valid.
4. Notie notification library and plugin.
Notie.js has an interesting design and is very flexible and customizable. It includes confirm and input features.
In HomeController.cs,
- public ActionResult Notie()
- {
- return View();
- }
In Note.cshtml,
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
- notie.alert({ type: 3, text: 'User Name Should Not Be Empty !!' })
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
- notie.alert({ type: 3, text: 'Password Should Not Be Empty !!' })
- }
- else {
- notie.alert({ type: 1, text: 'Registration Successful.' })
- }
- });
- });
- </script>
OUTPUT
If Username and Password fields are empty.
If both Inputs are valid.
5. iziToast notification library and plugin.
Elegant, responsive, flexible, and lightweight notification plugin that supports Drag/Touch support with no dependencies. It is supported by all modern browsers (Tested in Chrome, Firefox, Opera, Safari, IE10+ and Edge). iziToast provides an useful events API (global and per instance) and more than 60 options.
In HomeController.cs,
- public ActionResult iziToast()
- {
- return View();
- }
In iziToast.cshtml,
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
- iziToast.error({
- title: 'Error',
- message: 'User Name Should Not Be Empty !!',
- });
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
- iziToast.error({
- title: 'Error',
- message: 'Password Should Not Be Empty !!',
- });
- }
- else {
- iziToast.success({
- title: 'OK',
- message: 'Registration Successful.',
- });
- }
- });
- });
- </script>
OUTPUT
If Username and Password fields are empty.
If both inputs are valid.
6. VEX notification library and plugin.
VEX is a modern dialog library which is highly configurable and easy to style, developed by HubSpot.
With a cool design, good performance this plugin gets the third place in the top.
It has a clear and simple API, works on mobile devices, and can be customized to match your style in seconds.
In HomeController.cs,
- public ActionResult VEX()
- {
- return View();
- }
In VEX.cshtml,
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
- vex.dialog.alert({
- message: 'User Name Should Not Be Empty !!',
- className: 'vex-theme-flat-attack'
- });
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
- vex.dialog.alert({
- message: 'Password Should Not Be Empty !!',
- className: 'vex-theme-flat-attack'
- });
- }
- else {
- vex.dialog.alert({
- message: 'Registration Successful.',
- className: 'vex-theme-os'
- });
- }
- });
- });
- </script>
OUTPUT
If Username and Password fields are empty.
If both inputs are valid.
7. SweetAlert notification library and plugin.
Sweet Alert is a beautiful and really sweet replacement for the default alert function of JavaScript. With a smooth animation, cool design, and easy implementation, Sweet Alert has the second place from the top.
A special feature of sweet alert is that we can trigger any AJAX call and await till it is finished. This allows us to make the asynchronous handle with the user very easy and comfortable. SweetAlert can easily be themed to fit your site's design.
In HomeController.cs,
- public ActionResult SweetAlert()
- {
- return View();
- }
In SweetAlert.cshtml,
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
- sweetAlert("User Name Is Empty !!", "Please Mention", "error");
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
- sweetAlert("Password Is Empty !!", "Please Mention", "error");
- }
- else {
- sweetAlert("Congratulations!!", "Registration Successful.", "success");
- }
- });
- });
- </script>
OUTPUT
If Username and Password fields are empty.
If both inputs are valid.
8. Alertify notification library and plugin.
In the first place, we have Alertify.js, this plugin is in our opinion one of the most complete, useful, optimized and cool notification plugin that you will find on the internet for free. However, this is not only a plugin but a JavaScript framework for developing pretty browser dialogs and notifications. The code is pretty easy to understand and the implementation is a piece of cake,
the plugin is very straightforward.
Alertify.js have i18n and RightToLeft Support, have many themes and is customizable to the core.
In HomeController.cs,
- public ActionResult Alertify()
- {
- return View();
- }
In Alertify.cshtml,
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
- alertify.error('User Name Is Empty !!');
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
- alertify.error('Password Is Empty !!');
- }
- else {
- alertify.success('Registration Successful.');
- }
- });
- });
- </script>
OUTPUT
If Username and Password fields are empty.
If both inputs are valid.
9. OhSnap notification library and plugin.
ohSnap is a simple notification jQuery/Zepto library designed to be used in mobile apps. Really simplistic but with good performance.
In HomeController.cs,
- public ActionResult OhSnap()
- {
- return View();
- }
In OhSnap.cshtml,
- <div id="ohsnap">
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
- ohSnap('User Name Is Empty !!', { color: 'red' });
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
- ohSnap('Password Is Empty !!', { color: 'red' });
- }
- else {
- ohSnap('Registration Successful.', { color: 'green' });
- }
- });
- });
- </script>
- </div>
OUTPUT
If Username and Password fields are empty.
If both Inputs are Valid.
10. NOTY notification library and plugin.
NOTY is a jQuery plugin that makes it easy to create alert - success - error - warning - information - confirmation messages as an alternative the standard alert dialog.
Each notification is added to a queue. (Optional) The notifications can be positioned at the: top - topLeft - topCenter - topRight - center - centerLeft - centerRight - bottom - bottomLeft - bottomCenter - bottomRight
In HomeController.cs,
- public ActionResult NOTY()
- {
- return View();
- }
In NOTY.cshtml,
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
-
- new Noty({
- type: 'error',
- text: 'User Name Is Empty !!'
- }).show();
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
-
- new Noty({
- type: 'error',
- text: 'Password Is Empty !!'
- }).show();
- }
- else {
-
- new Noty({
- type: 'success',
- text: 'Registration Is Successful.'
- }).show();
- }
- });
- });
- </script>
OUTPUT
If Username and Password fields are empty.
If both Inputs Are Valid.
11. AmaranJS notification library and plugin.
AmaranJS is a minimalist notification library. It's easy to create notification animations and includes many themes, and it's easy to adapt your own themes and have callbacks. Highly customizable.
In HomeController.cs,
- public ActionResult AmaranJS()
- {
- return View();
- }
In AmaranJS.cshtml,
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
- amaran({
- content: 'User Name Is Empty !!',
- position: 'top left',
- sticky: true,
- color:'red'
- }).run();
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
- amaran({
- content: 'Password Is Empty !!',
- position: 'top left',
- sticky: true,
- color:'red'
- }).run();
- }
- else {
- amaran({
- content: 'Registration Is Successful.',
- position: 'top left',
- sticky: true,
- color:'green'
- }).run();
- }
- });
- });
- </script>
OUTPUT
If Username and Password fields are empty.
If both Inputs are Valid.
12. Notific8 notification library and plugin.
Notific8 is a JavaScript plug-in for easily displaying toast-style notifications on a web page.
It is designed to be easily customizable and comes with several themes (colors) and styles (theme families) baked in with an easy ability to create new ones.
The metro style gives a cool touch specially for asp.net developers.
The alert messages will appear on the top-right of the screen (windows 8 style).
In HomeController.cs,
- public ActionResult Notific8()
- {
- return View();
- }
In Notific8.cshtml,
- <script type="text/javascript">
- $(document).ready(function () {
- $("#SubmitProject").click(function () {
- if ($("#ValidateNametextbox").val() == "") {
- notific8('User Name Is Empty !!', {
- color: 'amethyst',
- heading: 'Satyapraksh Notification',
- sticky: true,
- closeText: 'Close'
- });
- }
- else if ($("#ValidatePwdtextbox").val() == "") {
- notific8('Password Is Empty !!', {
- color: 'amethyst',
- heading: 'Satyapraksh Notification',
- sticky: true,
- closeText: 'Close'
- });
- }
- else {
- notific8('Registration Successful.', {
- heading: 'Satyapraksh Notification',
- sticky: true,
- closeText: 'Close'
- });
- }
- });
- });
- </script>
OUTPUT
If Username and Password fields are empty.
If both Inputs Are Valid.
SUMMARY
- The top 12 most used notification libraries and plugins for JavaScript and jQuery.
- These can be implemented in ASP.NET MVC RAZOR.
- Project solution file describes codes easily.
- Mostly innovative and stylish notification libraries and plugins in today's market.