Search code examples
javascriptalpine.js

Add character inside AlpineJS x-text


Using AlpineJS I have the following code:

<span class="value" x-text="calculate"></span>

The function calculate returns a number.

How to inside the x-text add the character "€" after the number?


Solution

  • This should work:

    <span class="value" x-text="calculate() + '€'"></span>