简体   繁体   English

Javascript-带有jQuery问题的选项选择

[英]Javascript - Option select with jQuery issue

I want users to select an option from the drop down menu. 我希望用户从下拉菜单中选择一个选项。 The HTML goes like this: HTML如下所示:

<option value="111">AAA</option>
<option value="222">BBB</option>
<option value="333">CCC</option>`

When the page first loads, this is called: 页面首次加载时,称为:

query.auid = $('#tabs' option:selected').prop('value');

And it selects the first value as the default from the drop down menu. 然后从下拉菜单中选择第一个值作为默认值。 Now when the user selects another option and when the page reloads, it resets back to default value. 现在,当用户选择另一个选项并重新加载页面时,它将重置为默认值。 I want to save the last selected value by the user even after page reloads. 我想保存用户上次选择的值,即使页面重新加载后也是如此。 How do I achieve this? 我该如何实现?

将值存储在HTML5Local Storage中。HTML5存储

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM