Debugging onFocus event using Chrome Developer Tools? Can't return focus after break point

前端 未结 3 2067
孤独总比滥情好
孤独总比滥情好 2021-02-07 07:16

I\'m trying to debug a JavaScript onFocus event attached to a bunch of text boxes on a page. The bug occurs when selecting a text box and then tabbing to the next

3条回答
  •  粉色の甜心
    2021-02-07 08:19

    One option for debugging tricky cases is to set an interval to poll the focus in the console.

    setInterval(function() {console.log($(':focus')); }, 1000);
    

    Type this in the console (update it to include whatever details you are interested in), hit enter, and then keep the console where you can see it while you do stuff in your UI.

    *MDN docs for setInerval()

提交回复
热议问题