Let's say I have:
<h1>Win $50<h1>
I need to change the $ sign to € with jQuery
So I can do it like that:
$('h1').text( $('h1').text().replace('$', '€') );
But what if I have something like that:
<h1>Win $50 and Get $100</h1>
It only change the first one, How can I change it all?
Use regexp with g flag
$('h1').text( $('h1').text().replace(/\$/g, '€') );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With