[Answered ]-Represent number as currenct from paragraph

1👍

p does not have a value attribute. You can do this to get and format the number using intl number format

function on_load() {
  const costs = document.querySelector('#cost');
  let number = costs.childNodes[1].textContent;
  costs.childNodes[1].textContent = new Intl.NumberFormat('de-DE').format(number);
}
on_load();
<p class="article-content mb-1" id="cost"><strong>Cost [Euro]: </strong>1000000</p>

Leave a comment