Skip to content

Instantly share code, notes, and snippets.

@svaustin66
Last active December 15, 2017 16:56
Show Gist options
  • Save svaustin66/cbb2111d6bda85c84914f3044f5e3999 to your computer and use it in GitHub Desktop.
Save svaustin66/cbb2111d6bda85c84914f3044f5e3999 to your computer and use it in GitHub Desktop.
JavaScript for showing more or less text
<script>
$('.readmore').click(function (event) {
event.preventDefault();
var descriptionFull = document.querySelector('.product-description-full');
descriptionFull.style.display = 'block';
var descriptionShort = document.querySelector('.product-description-short');
descriptionShort.style.display = 'none';
});
$('.readless').click(function (event) {
event.preventDefault();
var descriptionFull = document.querySelector('.product-description-full');
descriptionFull.style.display = 'none';
var descriptionShort = document.querySelector('.product-description-short');
descriptionShort.style.display = 'block';
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment