Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The Element Object</h1>
<h2>The removeAttributeNode() Method</h2>
<a id="myAnchor" href="https://www.w3schools.com">A Link: Go to w3schools.com</a>
<p id="demo">Click "Remove" to remove the href attribute node from the a element.</p>
<button onclick="myFunction()">Remove</button>
<script>
function myFunction() {
  const element = document.getElementById("myAnchor");
  const attr = element.getAttributeNode("href");
  element.removeAttributeNode(attr);
}
</script>
</body>
</html>