<p>Selected Price: $<span id="price-display">0.00</span></p>
<script>
// Get references to the dropdown and the display element
const itemDropdown = document.getElementById('item-dropdown');
const priceDisplay = document.getElementById('price-display');
// Add an event listener to the dropdown
itemDropdown.addEventListener('change', function() {
// Get the selected option's value (which is the price)
const selectedPrice = this.value;
// Update the price display
if (selectedPrice) {
priceDisplay.textContent = parseFloat(selectedPrice).toFixed(2);
} else {
priceDisplay.textContent = '0.00';
}
});
</script>