I am currently working on a personal project using ASP.NET MVC5 and incorporating SweetAlert for managing message alerts. However, I have encountered an issue where the alert message only appears for a brief moment when testing it on an HTML5 button with the "onClick" event. Strangely, I am unable to click the "OK" button as the message disappears quickly without any error messages appearing in the browser console.
To address this problem, I have added the sweetalert.css file to my Content folder and the sweetalert.js script to my Scripts folder, ensuring that references are made in the BundleConfig.cs file:
In the _Layout.cshtml file, I have included the files in the following manner:
.css stylesheet:
.js script:
Within the view, a button with the "onClick" event calling "test()" has been placed inside a div element.
Despite these configurations, upon pressing the button, the alert message still appears for just a split second before vanishing.