I've constructed a simple test with jQuery to see if I can get an element to show/hide upon the clicking of a button.
HTML file:
<link href="test.css" rel="stylesheet" type="text/css" />
<script src="jquery.js" type="text/javascript"></script>
<script src="test.js" type="text/javascript"></script>
<input type="submit" id="show" value="Show content">
<div class="hidden">
Some content!
</div>
CSS file:
.hidden {
display: none;
}
Javascript file:
$(document).ready(function () {
$('#show').toggle(function () {
$('.hidden').removeClass('hidden');
}, function () {
$('.hidden').addClass('hidden');
});
});
... on the first click of the button, the content shows as expected, however on the second click it doesn't disappear. Can anybody tell me why?