Jump to content

Beyond

Member
  • Posts

    3
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Beyond reacted to jpeter in Currency Symbol Change   
    @Hamps Another alternative solution is to leverage the MutationObserver Web API which listens for changes to that .product-list element and replaces the $ with MVR whenever it detects that something has changed with that element:
    (function () { // Select the node that will be observed for mutations var productSummaryPrice = document.querySelector('.ProductItem-summary .product-price'); // Exit if target node isn't found. if(!productSummaryPrice) return; // Options for the observer (which mutations to observe) var config = { childList: true }; // Create an observer instance linked to the callback function var observer = new MutationObserver(function () { var text = productSummaryPrice.textContent; productSummaryPrice.textContent = text.replace('$', 'MVR '); }); // Start observing the target node for configured mutations observer.observe(productSummaryPrice, config); })(); Make sure the code above is between <script> tags, example:
    <script> // Add JS code here </script>  
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.