I am creating a layout with IE10-11 support. Most of my functions work, but the .text jQuery method does nothing. When I click on the button on my page, the text of some elements should change based on the passed argument to my function. The code:
const currenciesChars = new Map([
['rub', '₽'],
['usd', '$'],
['eur', '€']
])
const currenciesNote = new Map([
['rub', 'Руб'],
['usd', 'USD'],
['eur', 'EUR']
])
function changeCurrency(currency) {
$(".currency").text(currenciesChars.get(currency))
$(".currency-note").text(currenciesNote.get(currency))
}
changeCurrency('usd');
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="currency"></div>
<div class="currency-note"></div>
The console does not produce a single error. However, the function works if you add alert (123)
to it, you can verify this.
What is the problem of my code?