Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The Anchor Object</h1>
<h2>The hash Attribute</h2>
<p><a id="myAnchor" href="http://www.example.com:80/test.htm#part2">Example link</a></p>
<p>The anchor part of the link above is:</p>
<p id="demo"></p>
<script>
let text = document.getElementById("myAnchor").hash;
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>