Select menu not being restored when Back button used

后端 未结 6 936
予麋鹿
予麋鹿 2021-01-31 19:47

Consider a web page that has a select menu with a JavaScript event handler tied to the menu\'s onchange event that when fired reloads the page with a new query string (using the

6条回答
  •  感动是毒
    2021-01-31 20:10

    This is what happens by default in forms (not just selects): the browser will keep the last values. I wouldn't add any JavaScript code to alter this behavior unless you want to debug that code with multiple browsers.

    The easiest solution, that would fix the problem in most (all?) modern browsers, is to use autocomplete="off" in the

    tag.

    Edit: See answer https://stackoverflow.com/a/14421723/1391963

提交回复
热议问题