I would like to know how I can change a part of the text of the options of a select. I have a currency exchange calculator, and depending on the chosen currency, I should dynamically change the amount and name of the currency at the end of the movie name.
I have used but I don't know if it is the best option. The title of the film must always remain the same
<div class="movie-container">
<label>Pick a movie:</label>
<select id="movie">
<option value="10">Once Upon a Time <span class="replace">12 USD</span></option>
<option value="12">Pulp Fiction <span class="replace">10 USD</span></option>
<option value="8">Reservoir Dogs <span class="replace">9 USD</span></option>
<option value="9">Django: Unchained <span class="replace">8USD</span></option>
</select>
</div>
When a user chooses another to the dropdown, for example the Euro, the code should look like this:
<div class="movie-container">
<label>Pick a movie:</label>
<select id="movie">
<option value="10,8">Once Upon a Time <span class="replace">10,8 EUR</span></option>
<option value="8,9">Pulp Fiction <span class="replace">8,9 EUR</span></option>
<option value="7,6">Reservoir Dogs <span class="replace">7,6 EUR</span></option>
<option value="6,8">Django: Unchained <span class="replace">6,8 EUR</span></option>
</select>
</div>
Any ideas? Which selector should I use? You should change the number and currency code. I am using Fetch with the exchangerate-api.com API
Thanks !!