Hi I have this show more/less Click event and It changes on the first click but Im not sure how to get it to return to the previous state on the return Click.
New to JS. Can anyone help.
Thanks.
<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>
Aucun commentaire:
Enregistrer un commentaire