<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("a").click(function (event) {
event.preventDefault();
alert('disabled');
});
});
</script>
</head>
<body>
<a href="/">Go to dotnetheaven.com </a>
</body>
</html>
Here(http://api.jquery.com/event.preventDefault/), it is said: If this method is called, the default action of the event will not be triggered.
Question:
For the above code, the event means 'click'? 'the default action' is openning the URL? Am I understanding correctly? Because I wonder why alert still shows up after event.preventDefault()
.