In this tutorial, we will display alert box to prompt message using jQuery. In the below program , html page contains a "a href" link. On clicking this link ,a alert box prompt message "redirecting...." and when we click "Ok" button , it will redirect us to linked page. Note here, the redirection is due to link not due to alert box or jQuery.
Mylink.html
<html> |
Description of the program :
$(document).ready(function(){
// Your code here
});
The above code checks whether the page loading is finished and if finished then it executes the code in the block.
The code given below is used to display alert box on clicking link :
$("a").click(function(event){
alert("Redirecting you to jQuery.com!");
OUTPUT :

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.