Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:06:27+00:00 2026-06-15T19:06:27+00:00

I am running this cool product widget (show-space) on my website that puts selected

  • 0

I am running this cool product widget (show-space) on my website that puts selected products on there. It uses the following script:

<script>
  (function(d, s, id) {
    if (d.getElementById(id)) return;
    var fjs = d.getElementsByTagName(s)[0],
        js  = d.createElement(s); js.id = id;
    js.src = "http://www.show-space.com/widgets/manager.js?api_key=0qslzweoj79lp7h03ki9";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, "script", "showspace-manager-js"));
</script>

which is called by something like this: [ss-widget id=my_widget]

The problem I am encountering now is that the widget (which is no longer supported) uses USD (“$”) for all the product widgets while I prefer to show them in Swedish Krona (“kr”), which is typically placed after the number.

I would prefer:
a. change “$99” to “99 kr”
but
b. change “$99” to “SEK 99”
would work as well

I hardly know any JavaScript but was told that this could be solved with a JavaScript. So, what can I do in order to fix this?

Example on how the widget looks like: http://www.presenttips.se/fars-dag

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:06:28+00:00Added an answer on June 15, 2026 at 7:06 pm

    I would use a regex, personally.

    with jQuery:

    $(document).ready(function(){
        var contents=$('#my_widget').html();
        var rgx=/\$\s?(\d*(?:\.\d{2})?)/g;
        $('#my_widget').html(contents.replace(rgx,"$1 kr"));
    });
    

    With vanilla:

    var contents=document.getElementById("my_widget").innerHTML;
    var rgx=/\$\s?(\d*(?:\.\d{2})?)/g;
    document.getElementById("my_widget").innerHTML=contents.replace(rgx,"$1 kr"));
    

    Notes:

    This looks for prices in the following forms:

    $20

    $ 20

    $20.50

    $ 20.50

    Some examples of prices it would not find:

    $      20

    $20.999

    $20.9

    with the vanilla version you’ll need an event to trigger the javascript. This will likely be the body loading, so you’ll have something in your script tag like:

    body.onload=function() {
    var content=...
    ...
    };
    

    Edit: I’ve had a look at your page and can see (at least in that particular case) that your widget is defined by class name, rather than id. I’ve made the following change to the vanilla script and it works fine on the page you’ve linked – BUT you should be aware that in this implementation it will only work on the first occurrence of the widget it finds on each page… I think you are unlikely to have more than one to a page anyway, so it should be no biggie.

    Works on your page:

    var contents=document.getElementsByClassName("ss-widget")[0].innerHTML;
    var rgx=/\$\s?(\d*(?:\.\d{2})?)/g;
    document.getElementsByClassName("ss-widget")[0].innerHTML=contents.replace(rgx,"$1 kr");
    

    Final edit:
    As the above is shown to fudge some other things in the widget, here’s the working, jQuerified version including event handler registration and script tags

    <script> 
        jQuery(document).ready( //When the document is ready, run the following function...
            function(){
                jQuery('.ss-widget .product-price').each( //Pick everything with class product-price inside everything with class ss-widget and run the following function on each
                    function() {
                        var contents=jQuery(this).html(); //Get the contents of this element
                        var rgx=/\$\s?(\d*(?:\.\d{2})?)/g; //Define a regex to search for a dollar sign, followed by an optional space, followed by an arbitary amount of digits, optionally followed by a decimal plus 2 digits. Group everything but the dollar sign and space.
                        jQuery(this).html(contents.replace(rgx,"$1 kr")); //Replace any text found by the regex with it's grouped result, a space, then the text kr.
                    }
                );
            }
        );
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When running this XNA application it should display a rotated rectangle that moves from
In running this on index.html, I get the following error: Uncaught SyntaxError: Unexpected token
I have a tomcat server running a webapp. Apart from this there are two
So here is the story. I have this device that uses Linux and more
Running this program is printing forked! 7 times. Can someone explain how forked! is
Running this query takes a long time: SELECT host,ip FROM arecords WHERE ip IN
After running this query statement with my database: select * from articles where content
Im running this query on the same server as the web application, so SPQuery.ExpandRecurrence
Try running this in a .VBS file MsgBox(545.14-544.94) You get a neat little answer
When running this powershell command Get-ChildItem -Recurse -Include *.txt You get multiple tables in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.