I have this show more/less click event and It changes on the first click but I am not sure how to get it to return to the previous state on the return click.
<Html>
<head>
</head>
<body>
<div id="showit">Show More</div>
<div class="shown" style="display: none;">
Here is some content that I want to display
</div>
<script>
$(document).ready(function() {
var element = document.getElementById("showit");
$('#showit').click(function(){
$('.shown').slideToggle("fast");
element.innerHTML = "Show Less";
});
});
</script>
</body>
</html>
I am new to JS, can anyone help?
Thanks.