ginader / HTML5-placeholder-polyfill

Small and robust polyfill for the HTML5 placeholder attribut.
GNU General Public License v2.0
223 stars 85 forks source link

Add change event listener to hide placeholder when e.g. a password manager fills the form #69

Closed mmajis closed 9 years ago

mmajis commented 9 years ago

I realize a change event handler is not a silver bullet for handling this, but it should catch auto filling at any time as long as a change event is triggered along with the auto fill. Works with Chrome and LastPass.

Whether or not the change event is fired is up to browser and extension developers. Where the events are not fired, this could be used as a workaround: https://github.com/tbosch/autofill-event

For what it's worth, the WHATWG spec requires user agents to fire the event after auto filling: https://html.spec.whatwg.org/multipage/forms.html#event-input-change (end of chapter).

ginader commented 9 years ago

very helpful addition! Thank you @mmajis :-)