<head>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<a id="myLink" href="https://www.google.com" target="_blank">Go to Google</a>
<button id="getAttrBtn">Get Link URL</button>
<script>
$(document).ready(function() {
$("#getAttrBtn").click(function() {
alert("Link URL: " + $("#myLink").attr("href"));
});
});
</script>
</body>
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.