简体   繁体   English

我可以关闭 Pikaday 组件的自动完成功能吗?

[英]Can I turn off autocomplete for a Pikaday component?

I have a Pikaday date-picker component and it has a list of suggested (previous) values covering the calendar when using Chrome.我有一个 Pikaday 日期选择器组件,它有一个建议的(以前的)值列表,涵盖了使用 Chrome 时的日历。 I've tried autocomplete='off' and autocomplete='new-password' and neither of them seem to fix the issue.我试过 autocomplete='off' 和 autocomplete='new-password' 但它们似乎都无法解决问题。

along these lines沿着这些路线

<input type="text" class="js-date-picker" id="xyz" autocomplete="new-password" />

So looking at the comments so far either I have completely misunderstood the page that i was looking at (referenced by Liam in the comments) or I've not explained the issue properly.所以看看到目前为止的评论,要么我完全误解了我正在查看的页面(Liam 在评论中引用),要么我没有正确解释这个问题。

So On Chrome autocomplete="off" is bypassed.所以在 Chrome 上 autocomplete="off" 被绕过了。 I am getting something like this...我得到这样的东西......

在此处输入图像描述

I wondered if the hint, which the referenced page implies would work for any input field, but which, generally all examples use for input of type password (for obvious reasons) autocomplete="new-password" might help.我想知道引用页面暗示的提示是否适用于任何输入字段,但是通常所有示例都用于输入密码类型(出于显而易见的原因)autocomplete="new-password" 可能会有所帮助。 It hasn't helped, and for Chrome (specifically) out of Chrome, Chromium, Firefox & Safari I am still getting the unwanted behaviour.它没有帮助,对于 Chrome,Chromium,Firefox 和 Safari 中的 Chrome(特别是),我仍然遇到不想要的行为。

Does anyone have any hints for what I should try next?有没有人对我接下来应该尝试什么有任何提示?

Changing the type to date made it work.将类型更改为日期使其有效。 Obviously it added more work hiding the default calendar popup but that wasn't too tricky...显然它增加了隐藏默认日历弹出窗口的更多工作,但这并不太棘手......

<input type="date" class="js-date-picker" id="xyz" autocomplete="new-password" />

You can hide the suggestions just by adding the autocomplete="off" attribute.您可以通过添加autocomplete="off"属性来隐藏建议。

<input autocomplete="off" type="text" class="datepicker" name="start_date">

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

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