Return to Solutions Overview <-

Format Webflow CMS Numbers to German Number System - JavaScript

(Still under development as of March 15th 2023)

<!-- [BMG.studio] - Format Webflow CMS numbers -->
<script>
// Elements
const formatPriceElements = document.querySelectorAll('[data-format="price"]');
const formatYieldElements = document.querySelectorAll('[data-format="yield"]');

// Master loop
[{
    elements: formatPriceElements,
    digits: 0,
},
{
    elements: formatYieldElements,
    digits: 1,
}].forEach(function(obj) {
    // Elements loop
    obj.elements.forEach(function(element) {
        // Values
        let txt = element.innerHTML

        // Format
        txt = parseFloat(txt).toLocaleString('de-DE', {minimumFractionDigits: obj.digits})

        // Change DOM
        element.innerHTML = txt
    })
})
</script>


Enjoy!

FAQs

You still have an open question about BMG.studio and how we operate. Chances are good that you will find what you are looking for here:

Why does this FAQ exist?

Well. As of Wednesday, March 15th 2023, I think this component looks really cool.

Can I clone this FAQ component?

Yes. Yes you can. You can do so -> here <-

Still have questions?

It's okay to reach out. Use either email or our calendar tool