Last Updated: February 25, 2016
·
1.396K
· jonabrams

Easy access to HTML tags from Chrome's JS Console

In Chrome's JavaScript console, you can quickly access an HTML tag by referring to its ID as if it were a variable.

Given the following HTML snippet:

<div id="sidebar">My sidebar HTML goes here</div>

You can then refer to that div in the console like so:

sidebar.innerText = "Some replacement text"

1 Response
Add your response

Funny, just like good ol' IE did this)

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
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