问题描述
我一直在尝试创建一个书签来取消隐藏网页上的所有内容,但没有成功。这是我到目前为止的代码:
document.getElementsByTagName(*)[0].removeAttribute("hidden")
我该怎么做才能取消隐藏所有元素?
<p>Hi there</p>
<p hidden>This is hidden p text</p>
<b hidden>This is also hidden text with the bold tag</b>
<br><br/>
<button onclick="unhide()">Click Me</button>
<script>
function unhide() {
document.querySelectorAll("*").forEach(b => b.removeAttribute('hidden'));
}
</script>