Created
October 10, 2013 00:22
-
-
Save kogcyc/6910945 to your computer and use it in GitHub Desktop.
How the CSS display: none/block attribute works
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> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script> | |
<style type='text/css'> | |
body { | |
margin: auto; | |
} | |
#one { | |
width: 200px; | |
padding: 10px; | |
background-color: #99f; | |
} | |
#two { | |
width: 200px; | |
padding: 10px; | |
background-color: #9f9; | |
} | |
#three { | |
width: 200px; | |
padding: 10px; | |
background-color: #f99; | |
} | |
</style> | |
<script type='text/javascript'> | |
$( document ).ready(function() { | |
$("#one").click(function() { | |
$("#two").css('display', 'none'); | |
}); | |
$("#three").click(function() { | |
$("#two").css('display', 'block'); | |
}); | |
}); | |
</script> | |
<body> | |
<div id="one">One</div> | |
<div id="two">Two</div> | |
<div id="three">Three</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment