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

<h1>HTML DOM Attributes</h1>

<h2>removedNamedItem() 方法</h2>

<input id="myInput" type="button" value="OK">

<p>点击下面的按钮可去掉上面的输入元素的 type 属性。</p>

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

<script>
function myFunction() {
  const nodeMap = document.getElementById("myInput").attributes;
  nodeMap.removeNamedItem("type");
}
</script>

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