简体   繁体   English

保留表单值(例如下拉菜单和单选按钮)而不使用任何Web存储

[英]To retain form values such as dropdown and radio buttons without using any webstorage

I have a form and wanted to retain its values when form loads without using any web storage. 我有一个表单,想在加载表单时保留其值,而不使用任何Web存储。

I want to use only Javascript or jQuery. 我只想使用Javascript或jQuery。 Moreover, I want that form values such as radio and dropdown selected value should retain its previous filled values. 此外,我希望表单值(例如radio和dropdown选定值)应保留其以前的填充值。

You can either use browser cache or cookies to retain data on the client side. 您可以使用浏览器缓存或cookie在客户端保留数据。 But both have their own limitations. 但是两者都有其自身的局限性。 Smartphone Browser native cache is about 5x times slower than local storage and information about cookies is sent to the server in the request header when a user visits a page that has cookies associated with it. 智能手机浏览器的本机缓存比本地存储慢大约5倍,并且当用户访问具有与之关联的cookie的页面时,有关cookie的信息会发送到请求标头中的服务器。

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

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