On click of the hyperlink , i need to display an alert .
I tried this way , but somehow the alert is not appearing on click of that hyper link .
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" >
</script>
<title>New Web Project</title>
<script type="text/javascript">
$(function() {
$('#kiranhype').click(function() {
alert('Handler for .click() called.');
});
});
</script>
</head>
<body>
<P><a href="kiranhype">Click for a greeting</a></p>
</body>
</html>
$(‘#id’) is an ID selector. Therefore, your tag should read
Alternatively, if you just wanted an alert, you could do something like
EDIT: See this jsfiddle