Skip to content

Instantly share code, notes, and snippets.

@jiripudil
Last active December 17, 2015 14:49
Show Gist options
  • Save jiripudil/5627154 to your computer and use it in GitHub Desktop.
Save jiripudil/5627154 to your computer and use it in GitHub Desktop.
Snippet that allows you to inspect elements in Google Chrome Dev Tools with a single click
document.addEventListener('click', function (e) {
// the combination can be changed easily
// in this case it is Ctrl + Shift + MMB
if (e.button == 1 && e.ctrlKey && e.shiftKey) {
// fire up Inspector focused on the clicked element
inspect(e.target);
// prevent default action (e.g. do not click through links)
e.preventDefault();
// prevent the event from bubbling further through the DOM
e.stopImmediatePropagation();
}
// true - capture the event in the initial phase of event flow
}, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment