A Pen by Gary Smith

Thumbnail
This awesome code was written by scopevale, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright scopevale ©
  • HTML
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>A Pen by  Gary Smith</title>
  
  
  
  
  
</head>

<body>

  
<p id="myP">This is a p element.</p>

<button type="button" onclick="myFunction1()">display none</button>

<button type="button" onclick="myFunction2()">display inherit</button>

<button type="button" onclick="myFunction3()">Visibility hidden</button>

<button type="button" onclick="myFunction4()">Visibility visible</button>

<script>
function myFunction1() {
    document.getElementById("myP").style.display = "none";
}
</script>
<script>
function myFunction2() {
    document.getElementById("myP").style.display = "inherit";
}
</script>

<script>
function myFunction3() {
    document.getElementById("myP").style.visibility = "hidden";
}
</script>
<script>
function myFunction4() {
    document.getElementById("myP").style.visibility = "visible";
}
</script>
  
  

</body>

</html>

Comments