Elhilali Yassine
Elhilali Yassine

Reputation: 28

How to fire autofill event in Javascript

I am working on a project where I have to take input from the user, do some calculations, and suggest an output to the user, and when I have something to suggest, I turn the input background to yellow, to declare to the user that it's a suggestion.

enter image description here

The problem I have is that I noticed that browsers treat input suggestions differently. For example, the background color of the input may change from a browser to another (Chrome uses a blue background color, and Safari uses a yellow one). What I'm trying to do is to fire an event on JS (or any other solution) to let the browser decide which style to give to the input. Is there a way to do that ? or is the browser not allowing that to happen programmatically ?

Upvotes: 0

Views: 1408

Answers (1)

Satel
Satel

Reputation: 187

You need to make the auto filling logic by yourself. The browser's autofilling API is not supporting such kind of customization.

You can check this simple example to make the autocomplete. That's different what you think, but in this way, you would need to make custom logic when filling it.

I would like to collaborate via sandbox if you give me more detail.

Upvotes: 1

Related Questions