Search code examples
attributeshiddenbookmarklet

Is there some way to remove the "hidden" attribute in all elements of a page?


I've been trying to create a bookmarklet that unhides everything on a webpage, but it hasn't been working. Here's the code I have so far:

document.getElementsByTagName(*)[0].removeAttribute("hidden")

What do I have to do for it to unhide ALL elements?

Edit: I have found a line of code in the question linked below, thanks for helping!

<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>


Solution

  • Have a look at Find and remove attribute on all elements of a certain type

    Best regards