How to check if an HTML element is loaded or not using jQuery
How to Hide HTML Element onclick in jQuery Easily
Moreover, If you click on a link or click on something which gonna navigate away from the webpage it will also prompt you.
Below I am providing a full example so that you can understand it properly.
Remeber earlier versions of browsers allowed you to set custom messages in the alert dialog box, But now it’s not possible. The custom alert message can’t be set now. See the special notes added in the bottom of this tutorial post.
Just include your jQuery. (you can use CDN like Google, <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> )
Or you can simply download jquery.min.js and include that.
Now just test it on your browser.
If you click on google link it will prompt you.
Below is the screenshot of the alert message
If you try to close the current tab the same message will appear.
Real Time Chat Application PHP With File Transfer System AJAX
Calculate the distance between mouse and element in jQuery
Special Notes: confirm() method can take messages in the form of string as a parameter, but the newer versions of chrome and other browsers do not allow you to use custom messages in the alert box.
it’s about confirm, not alert.
what about “alert”, please ?
If I have a login form and I want to avoid to receive the alert only with the login how can I do it.