<!doctype html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$("#spoiler").click(function() {
if ($(this).text() == "Show Text") { // If the button text is currently "Show Text"...
$(this).text("Hide Text"); // Change it to "Hide Text"
}
else {
$(this).text("Show Text"); // If anything else, simply make it "Show Text"
};
$(".spoiler_contents").slideToggle(); // Slide the spoiler contents up/down
});
});
</script>
<style type="text/css">
@import url(http://fonts.googleapis.com/css?family=Roboto); /* Google Font, to make things sexy */
#spoiler {
background-color: #E33535;
color: #fff;
padding: 10px;
font: normal 12px Roboto;
border-radius: 3px;
text-decoration: none;
}
.spoiler_contents {
display: none;
font: normal 14px Roboto;
margin-top: 15px;
}
</style>
</head>
<body>
<a href="#" id="spoiler">Show Text</a>
<p class="spoiler_contents">Quick, hide me!</p>
</body>
</html>