Debug an element by adding an ID of "test"

TIL thanks to a tweet from Devon Govett...

If you add an ID of "test" to an element:

<div id="test"></div>

You can access it using the global variable test from JS from the console. Could be handy for debugging.

Bonus:

Also, incase you dind't know, any highlighted selected in the "Elements" tab of developer tools can be accessed directly in the console with $0.

🐛 Happy debugging!

Comments

No comments

It's a bit quiet here. Why not be the first to post something?

Subscribe to our newsletter

No spam. Just simple and infrequent platform updates when something big happens.

© 2024 TechTalks.io Limited. All rights reserved.