Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello @PernillaH
You can use below code.
<div id="product-description" class="product-description">
{{ product.description }}
</div>
<button onclick="myFunction()" class="read-button" id="read-more">Read More</button>
<button onclick="myFunction1()" class="read-button d-none" id="read-less">Read Less</button>
<script>
function myFunction1() {
var element = document.getElementById("product-description");
element.classList.remove("mystyle");
var readmore = document.getElementById("read-more");
var readless = document.getElementById("read-less");
readless.classList.add("d-none");
readmore.classList.remove("d-none");
}
function myFunction() {
var element = document.getElementById("product-description");
element.classList.add("mystyle");
var readmore = document.getElementById("read-more");
var readless = document.getElementById("read-less");
readless.classList.remove("d-none");
readmore.classList.add("d-none");
}
</script>
Thank You
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024