Search code examples
google-chrome-devtools

Debug "click" event in Chrome developer


Is it possible to debug in Chrome developer when a click event is performed? I can see the addEventListener is created but I cannot see it happening after I click that element.

if (storedEntry !== '') {
        element.addEventListener('click', (event) => {
            event.preventDefault();
            sessionStorage.removeItem(storageKey);
            document.location.href = storedEntry;
        });

I tried to set a breakpoint and debug but it just skips over the block element.addEvenListener.


Solution

  • while doing debugging you need to go in inspect view / source click on the file where you want to debug and place the breakpoint on your javascript function or write debugger; before your code to hold at that position.