How to open a alert box within anchor tag <a href>?
You can also use the following codes:
<a href="#" id="link">Link</a>
Javascript:
$(document).on("click","#link",function(){
alert("I am a pop up ! ");
});
OR:
<a href="#" onclick="alert('I am a popup!');">Link</a>
Without using a JS file (purely as an alternative to answers already posted):
<a href="http://example.com" onclick="alert('Hello world!')">Link Text</a>