Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
How to unhide a hidden html <p> tag element using JavaScript?

I have the following hidden <p> element in the body tag of my HTML file (for my chrome extension).

<p hidden id="button">
    <a id="dashboard-btn" href="www.google.com" target="_blank" rel="noopener noreferrer">
      www.google.com
    </a>
</p>

I want to unhide this using JavaScript. My random try that failed to unhide it:

document.getElementById("button").style.visibility = 'visible';

[SOLVED] This (also) worked:

document.getElementById("button").style.display = "block";
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

You can use removeAttribute

document.getElementById("button").removeAttribute('hidden')
<p hidden id="button">
  <a id="dashboard-btn" 
     href="www.google.com" 
     target="_blank" 
     rel="noopener noreferrer">
      www.google.com
    </a>
</p>

about 4 years ago · Juan Pablo Isaza Report

0

You hide your element with attribute hidden so you need to control that attribute instead of style like:

document.getElementById("button").hidden = false; 
<p hidden id="button">
    <a id="dashboard-btn" href="www.google.com" target="_blank" rel="noopener noreferrer">
      www.google.com
    </a>
</p>

Reference:

  • hidden
about 4 years ago · Juan Pablo Isaza Report

0

Try with this

document.getElementById("button").removeAttribute("hidden")
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!