开发者

jQuery preventDefault stops autocomplete from working

开发者 https://www.devze.com 2023-02-07 09:52 出处:网络
Has anyone else run into the issue where handling a click event on a s开发者_运维问答ubmit button for a form with preventDefault stops autocomplete from working?

Has anyone else run into the issue where handling a click event on a s开发者_运维问答ubmit button for a form with preventDefault stops autocomplete from working?

To be specific it simply never prompts to save the username and password combination, I assume this is because it is triggered on a post request which doesn't occur in my case.

Can anyone think of a workaround?

PS: I have only tested in IE but am willing to bet I will see similar issues in the other browsers (will test shortly).


You have three options when altering the flow of an event:

  1. e.preventDefault()
  2. e.stopPropagation()
  3. return false (calls both of the above).

Maybe trying using e.stopPropagation() instead, and see what that does for you.

0

精彩评论

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

关注公众号