开发者

Autocomplete doesn't work with javascript generated input fields

开发者 https://www.devze.com 2023-03-18 07:34 出处:网络
If you generate a login overlay with javascript (via ajax loaded content or with JS temp开发者_StackOverflow中文版lates), browsers usually (firefox, safari) don\'t use autocomplete in these input fiel

If you generate a login overlay with javascript (via ajax loaded content or with JS temp开发者_StackOverflow中文版lates), browsers usually (firefox, safari) don't use autocomplete in these input fields. It's really annoying, do you have any ideas how can I fix this?

Do I need to generate a hidden form inside the original HTML and move this form into this overlay?

Thanks, Andras


I was doing the same, using javascript to produce and get values from input fields. They would not autocomplete any text. I discovered that placing the input field in <form></form> allowed autocomplete to work as it should. I wasn't including the form element at first because I wasn't submitting any form, just making an ajax call. And now that use use <form> you just gotta prevent the default form submit and make the ajax call instead. For example <form onsubmit="return false;">

0

精彩评论

暂无评论...
验证码 换一张
取 消