Created
August 18, 2015 21:51
-
-
Save davidverhage/6c10eb00de3931f08ff7 to your computer and use it in GitHub Desktop.
Show and hide element or part
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
<?php | |
/** | |
* A smooth way of hiding and showing certain elements using jQuery | |
* | |
*/ | |
?> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
$("#hide").click(function(){ | |
$("p.magic").hide(); | |
}); | |
$("#show").click(function(){ | |
$("p.magic").show(); | |
}); | |
}); | |
</script> | |
<p class="magic">Content initially hidden can be shown, or if shown can be hidden.</p> | |
<button id="hide">Hide</button> | |
<button id="show">Show</button> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment