DOM debugging helper functions
Paste these into your browser JavaScript console for navigating the DOM more quickly while debugging:
function $(id) {
return document.getElementById(id);
}
function $t(tag, context) {
return (context || document).getElementsByTagName(tag);
}
function $$(expr, context) {
return (context || document).querySelectorAll(expr);
}
This works great with Chrome Canary's new Snippets feature.
Written by Eric Wendelin
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Debugging
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#