Explore Topics

How to Show Hidden HTML Elements using Javascript?

Last Updated : 18 Apr, 2025 - Asked By Ashok

Here is my HTML code

    <p id="para" style="display:none;">This is a HTML code</p>
    <button type="button">Click Here to change the p tag Font Size</button>

I want to show the id para when clicking the button. How to do this using Javascript?

js  show hidden html elements 

Answers
2024-05-15 06:24:01

   

<p id="para" style="display:none;">This is a HTML code</p>

<button type="button" onclick="show()">Click Here to show the hidden paragraph</button>

 

<script>

  function show() {

    var s = document.getElementById('para');

    para.style.display = 'block';

  }

</script>

Your Answer



Other Resources

Quiz Image
Quiz

Test your knowledge with interactive quizzes.

Interview Questions Image
Interview Questions

Prepare for interviews with curated question sets.

Q&A Image
Q&A

Ask your coding-related doubts and get answers.

Certification Image
Certification

Earn certifications to enhance your resume.

internships Image
Internships

Hands-on projects to improve your skills.

Quiz Image
Quiz

Test your knowledge with interactive quizzes.

Interview Questions Image
Interview Questions

Prepare for interviews with curated question sets.

blog Image
Blogs

Add your technical blogs and read technical topics.

Certification Image
Certification

Earn certifications to enhance your resume.

Q&A Image
Q&A

Hands-on projects to improve your skills.