Home / Programs / How JavaScript can hide HTML elements.
Programming Example

How JavaScript can hide HTML elements.

👁 429 Views
💻 Practical Program
📘 Step by Step Learning
JavaScript can hide HTML elements.

Program Code

<!DOCTYPE html>
<html>
<body>

<h2>What Can JavaScript Do?</h2>

<p id="demo">JavaScript can hide HTML elements.</p>

<button type="button" onclick="document.getElementById('demo').style.display='none'">Click Me!</button>

</body>
</html> 

Output

Run Above Code

Explanation

No

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.