有没有办法在按下 <select> 列表中的 <option> 时自动重新加载页面?

Is there a way to automatticaly reload the page when an <option> from a <select> list is pressed?

在网页中,我有一个 select HTML 列表,用户可以从中 select 一个项目并更改其价格。我在下面放了 select 和一个输入文本框。它的默认值需要是元素的当前价格,以便用户可以看到并更改它。但是,当我更改下拉菜单中的 selected 项目时,输入文本框继续显示最后一项的价格。我认为通过在用户单击下拉列表中的选项时刷新页面,这将得到解决,但我不知道如何解决。我希望这个疑问足够清楚,如果您不明白,请告诉我。非常感谢您的帮助!!

我一直在等你展示一些代码,但你没有,所以根据你的问题,你不需要重新加载页面,你需要适当地处理事件,仅此而已,所以我做了这个例子给你,我已经说过你可以使用 location.reload 和其他东西,但那是因为那时我还没有阅读你问题的 body,我只是根据问题的标题,反正这里是例子,我加了一些注释让你看懂代码

// an example of some products and the price of each one
var products = {"ring": 2.54, "watch": 4.99, "necklace": 3.21},
  // get the `<select>` dom element
  productsList = document.querySelector("#products-container select"),
  // get the `<input type="text">` dom element
  productPrice =document.querySelector("#products-container input");

// set the value of the price input to the first product's price
productPrice.value = Object.values(products)[0];

// loop over the products and create an option for each one
for(var product in products) {
  productsList.innerHTML += `<option value="${product}">${product}</option>`;
}

// when the user chooses a product we show its price on the price input
productsList.onchange = function() {
  productPrice.value = products[this.value];
}

// when the user changes the price of an element we save that into our object of elements
productPrice.onchange = function() {
  products[productsList.value] = this.value;
}
<div id="products-container">
  <select>
  </select>
  <input type="text">
</div>