简体   繁体   中英

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. I've tried autocomplete='off' and autocomplete='new-password' and neither of them seem to fix the issue.

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.

So On Chrome autocomplete="off" is bypassed. 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. It hasn't helped, and for Chrome (specifically) out of Chrome, Chromium, Firefox & Safari I am still getting the unwanted behaviour.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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