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

前端 未结 3 2025
孤独总比滥情好
孤独总比滥情好 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:07

    Chrome Dev Tools includes a Play/Pause button both in the Inspector and as an overlay to the webpage. Using the overlay prevents focus from landing on the Inspector.

    Also, I've found the following type of logging solution to be easier to track than the interval method (thanks to less redundancy and the ability to pick up on changes that occur more rapidly than the interval):

    $('*').on('focus blur', function(event) {console.log(event.type + " to:"); console.log(document.activeElement);});
    

提交回复
热议问题