📅  最后修改于: 2022-03-11 15:03:39.288000             🧑  作者: Mango
function myFunction(sel) {
var opt = sel.options[sel.selectedIndex];
var price = opt.dataset.price
document.getElementById("demo").innerHTML = "You selected: " + price;
}
Select a new car from the list.
When you select a new car, a function is triggered which outputs the value of the selected car.