Google chrome causing infinite loop on textbox focus

前端 未结 5 1186
孤街浪徒
孤街浪徒 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:18

    This is happening because it is setting focus back to the text box. Try this it should work fine in Chrome

    $('input[type="text"]').live('focus', function(event) {
        alert('in');
        $(this).blur();
    });
    

提交回复
热议问题