Google chrome causing infinite loop on textbox focus

前端 未结 5 1176
孤街浪徒
孤街浪徒 2021-01-18 05:39

I\'m getting some strange happenings on google chrome. With the following code I\'m getting an infinite number of alerts.

<

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-18 06:25

    The problem is that the alert() is stealing focus from the input box, and then restoring it when the dialog is closed. You can fix this by clearing focus from the input box before you show the alert.

    Example: http://jsfiddle.net/XppG9/6/

提交回复
热议问题