Alex Cristerna
Alex Cristerna

Reputation: 41

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.

Any guesses? Is https required for autocomplete to work?

I've tried the following using Safari and 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' />

Upvotes: 4

Views: 2570

Answers (3)

Thomas Wood
Thomas Wood

Reputation: 819

I found that I had to wrap all of my inputs in a <form> element. Empty was fine.

Upvotes: 1

Alex Cristerna
Alex Cristerna

Reputation: 41

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.

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

For the expiration month and year I used exp_month and exp_year.

Upvotes: 0

Matei Misarca
Matei Misarca

Reputation: 1

Try using it like this:

<input autoComplete={'off'}>

Upvotes: 0

Related Questions