Created
November 17, 2018 13:16
-
-
Save shaina7837/c25bca17c6498946b7171e031ef7260a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<div id="container" onclick="hidetext()"> | |
<div id="middle" onclick="showtext()"> | |
<p id="text">Something</p> | |
</div> | |
</div> | |
</body> | |
<style> | |
#container { | |
width: 300px; | |
margin: auto; | |
height: 200px; | |
border: 1px solid #333; | |
} | |
#middle { | |
width: 100px; | |
margin: 50px 100px; | |
background: #fff0a0; | |
height: 50px; | |
cursor: pointer; | |
} | |
#text { | |
display: none; | |
} | |
</style> | |
<script type="text/javascript"> | |
let container = document.getElementById('container'); | |
let middle = document.getElementById('middle'); | |
let text = document.getElementById("text"); | |
function showtext(){ | |
text.style.display = "block"; | |
} | |
function hidetext(){ | |
console.log("hide"); | |
text.style.display = "none"; | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment