代码示例:(标识:jsck_element_removeattribute_2)
<!DOCTYPE html>
<html>
<body>

<a id="myAnchor" href="https://www.sou-xun.com">链接:访问 sou-xun.com</a>

<p id="demo">单击该按钮可从 a 元素中删除 href 属性。</p>

<button onclick="myFunction()">试一试</button>

<script>
function myFunction() {
  document.getElementById("myAnchor").removeAttribute("href"); 
}
</script>

</body>
</html>
运行结果: