Scriptbar Snippets 🚀
Handy and easy to understand snippets to keep in your browser


Pause javascript execution on keydown. Handy to debug dynamic element

Have you ever face issue where you hover over an element but at the same time, want to peak at a variable, state or what css classes are binded to that element? This script will pause current page javascript excution on "Enter" keydown. Of course, you can replace it with other key.

  • Hover on the target element, and click the Enter key
  • The dynamic element is displayed and visible under the Elements tab

Pause javascript execution on keydown demo

/* * Pause javascript execution on keydown. This is handy when your page * have a dynamic element that you want to pause the execution of javascript. */ ((document) => { document.addEventListener("keydown", (e) => { if (e.key === "Enter") debugger; }); })(document);
Built with ❤️ by @domnguyen and everyone on the internet 🚀