使用ReactJS自动完成属性

时间:2015-09-21 21:49:52

标签: javascript google-chrome autocomplete safari reactjs

我试图在信用卡详细信息上使用autoComplete属性(不以任何形式包装),但它无效。

任何猜测?自动填充功能需要https吗?

我使用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' />

3 个答案:

答案 0 :(得分:1)

我发现我必须将所有输入都包含在<form>元素中。空的很好。

答案 1 :(得分:0)

尝试使用它:

<input autoComplete={'off'}>

答案 2 :(得分:0)

感谢您的回答。这对我不起作用。 我只是想通了:使用带有name值的idcc_number道具,当然,不在localhost上运行项目,就可以了。

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

对于到期月份和年份,我使用了exp_monthexp_year