Tutorial on anchor tag:

In this tutorial, we will learn how to change the default behavior of the anchor tag. To make it more clear, we will try to display an alert box with a small message when you click on the anchor tag instead of taking you to the source link which was feed in the anchor tag.
Create a page named index.html. Add the following code into the file.

 

<a href="http://freefeast.info/">Visit freefeast.info</a>//

In the above script tag you can see that i have placed the following link:
ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js

This is the link of a CDN. You can read more about CDNs here.

When you run the above mentioned page in the browser, you will see a link “Visit freefeast.info”. When you click on this link it will actually take you to freefeast.info.

Now, this is the default behavior of the anchor tag. We will try to over ride this behavior and try to make the anchor tag display a alert message.

Replace the comment //your Code goes here with the following code

$( document ).ready(function() {
$( "a" ).click(function( event ) {
alert( "Thanks for visiting this site" );
event.preventDefault();
});
});