简体   繁体   English

使用ReactJS自动完成属性

[英]Autocomplete attribute using ReactJS

I'm trying to use autoComplete attribute for credit card details on 's (not wrapped in any form) but it is not working. 我正在尝试使用autoComplete属性来获取信用卡详细信息(不以任何形式包装),但它不起作用。

Any guesses? 任何猜测? Is https required for autocomplete to work? 自动填充功能是否需要https才能运行?

I've tried the following using Safari and Chrome: 我使用Safari和Chrome尝试过以下操作:

<input type='text' placeholder='xxxx xxxx xxxx xxxx' value={this.state.card} autoComplete='on' />

<input type='text' placeholder='xxxx xxxx xxxx xxxx' value={this.state.card} autoComplete='cc-number' />

I found that I had to wrap all of my inputs in a <form> element. 我发现我必须将所有输入包装在<form>元素中。 Empty was fine. 空的很好。

尝试使用它像这样:

<input autoComplete={'off'}>

Thanks for the answer. 谢谢你的回答。 That didn't work for me. 这对我不起作用。 I just figured out: Using name and id props with cc_number value and of course, not running the project on localhost, works. 我只是想通了:使用带有cc_number值的nameid props,当然,不在localhost上运行项目,有效。

<input type='text' name='cc_number' id='cc_number' ... />

For the expiration month and year I used exp_month and exp_year . 对于到期月份和年份,我使用了exp_monthexp_year

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

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