diff --git a/README.md b/README.md index 1035ec1..a677cf0 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,13 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_365 TILs and counting..._ +_366 TILs and counting..._ --- ### Categories +* [Chrome](#chrome) * [Clojure](#clojure) * [Devops](#devops) * [Elixir](#elixir) @@ -30,6 +31,10 @@ _365 TILs and counting..._ --- +### Chrome + +- [Reference The Selected Node](chrome/reference-the-selected-node.md) + ### Clojure - [Aggregation Using merge-with](clojure/aggregation-using-merge-with.md) diff --git a/chrome/reference-the-selected-node.md b/chrome/reference-the-selected-node.md new file mode 100644 index 0000000..8de4555 --- /dev/null +++ b/chrome/reference-the-selected-node.md @@ -0,0 +1,20 @@ +# Reference The Selected Node + +In the Chrome dev tools, if you've selected (highlighted) a node in the DOM, +you can reference that node from the console with `$0`. This is handy if you +are debugging or exploring certain parts of a page and need to run commands +against that node. For instance, if you were to select the `` node in +the DOM, you could then programmatically check the `lang` attribute from the +console like so: + +``` +> $0.lang +// "en-US" +``` + +If there is `jQuery` on the page and I've selected the node that contains +all of the page's content, I can do something like the following: + +``` +> $($0).html('

Hello, World!

') +```