Here is the HTML and JavaScript code that I am currently working with:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-3.3.1.min.js"></script>
</head>
<body>
<a href="#foo" id="bar">Something</a>
<div id="foo></div>
<script>
$(function() {
$link = $("#bar");
$link[0].click(function() {
alert("Whatever.");
});
});
</script>
</body>
</html>
If you want to learn more about this topic, check out this article. Unfortunately, the code is not functioning as intended - no alertbox is displaying. Any suggestions on how to fix this issue?