当从 Chrome 中的 javascript 提交时,输入字段值不会添加到字段历史记录中
有谁知道当表单从 Chrome 中的 javascript 提交时如何将输入字段的值添加到该输入字段的历史记录中? (这个问题在 Firefox 中不会出现。)或者我必须启用什么? autocomplete='on' 不适用于输入字段。
例如,在登录表单中,最好让浏览器记住登录信息,这样用户就不需要再次输入。
我当前正在使用表单对象上的 jQuery 提交()方法提交表单,但当我再次加载页面时,用户字段不记得登录名?
如果我使用提交按钮提交表单,则此方法有效。
Does anybody know how to add the value of an input field to the history of that input field when the form is submitted from javascript in Chrome? (The problem does not appear in Firefox.) Or what do I have to enable? autocomplete='on' does not work on the input field.
For example, in a login form it is nice to have the browser remember the login such that the user does not need to input it again.
I am currently submitting the form with jQuery's submit() method on the form object but the user field does not remember the login name when I load the page again?
This works if I submit the form using a submit button.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,没有办法通过 JavaScript 以编程方式完成此操作。为了确保跨浏览器和提交类型的支持,我建议实现您自己的自动完成并维护历史记录。有很多用于自动完成的库,并且通过 ajax 进行存储/检索应该是基本的。如果您需要进一步的指导,请告诉我。
To my knowledge there's no way to do this programmatically via Javascript. To ensure support across browsers and submission types, I would recommend implementing your own autocomplete and maintaining the history. There are lots of libraries out there for autocomplete and storage/retrieval via ajax should be elementary. Let me know if you need further guidance.
您需要像 AutoCompleteSaveForm 这样的东西。但这是“仅限 IE”。所以这不是一个解决方案。
You need something like AutoCompleteSaveForm. But it's "IE only". So it's not a solution.