-1

I'm sorry if this question sounds kind of silly, but i hope someone can help me out :).

I need to remove a euro(€) sign from a span that looks like:

<span id='price'>€ 19,99</span>

the thing is that i cant change it in the HTML file because these prices are automatically given by this webshop program ...

my first thought was javascript/jquery with a substring or slice method, but i wasnt able to figure out how to do this.

Any suggestions ?

barbaart
  • 837
  • 6
  • 14

3 Answers3

1

Jquery solution:

 $('#price').text( $('#price').text().replace('€', '') );
Every Screamer
  • 520
  • 2
  • 7
0

Use Element.innerText to get the text and String.replace to remove the euro sign:

var price_span = document.getElementById('price');

price_span.innerText = price_span.innerText.replace('€', '');
<span id='price'>€ 19,99</span>
DjaouadNM
  • 22,013
  • 4
  • 33
  • 55
0

Only with CSS and since the sign is at the beginning of the string, you could use a negative text-indent (adjustable, depending on your specific font family ad size)

#price {
  text-indent: -2ch;
  display: inline-block;
  overflow: hidden;
}
<span id='price'>€ 19,99</span>
Fabrizio Calderan
  • 120,726
  • 26
  • 164
  • 177