JSFiddle - React, Tailwind, and code Playground
HTML
<select id="inv_currency">
<option value="£">£</option>
<option value="€">€</option>
</select>
<span class="invE_balance currency">
£
<span>0.00</span>
</span>
JavaScript
//* currency
$('#inv_currency').on('change', function () {
var currency = $('.currency');
if (this.value.trim() == '£') {
currency.each(function (index) {
var elem = $(this).contents().filter(function() {
return this.nodeType === 3;
});
var text = elem.text();
elem[0].nodeValue = text.replace("€", "£");
});
} else {
currency.each(function (index) {
var elem = $(this).contents().filter(function() {
return this.nodeType === 3;
});
var text = elem.text();
elem[0].nodeValue = text.replace("£", "€");
});
}
});