I’m using a WordPress Theme and need to modify the output of a counter animation.
While the page is loading, there is an empty span like this:
<span class="counter"></span>
After the animation is finished, the span looks like this:
<span class="counter">30.5</span>
Since it is a german website the output needs to be with a comma instead of a dot, so it should look like this: 30,5
How can I achieve this?
Reading similar posts it looks like I need a WebKitMutationObserver (?) but I have no experience using it. Thanks for any help!
2
Answers
Using
value.toLocaleString('en-de',{...})
will solve your purpose