Shorthand for searching a View's DOM in Backbone

August 16, 2012 Mark Rushakoff

Sometimes you use a pattern so frequently that you don’t realize that other people might not know about it. Here’s the most recent one for me — I was surprised that this wasn’t being used in the last few codebases I’ve seen:

If you’re using Backbone.js, instead of writing


or worse



$('span.timestamp', view.$el)

Backbone provides a $ method such that you can simply write


It’s less to type and it doesn’t hurt readability.

About the Author


Researchers Encode Entire Book Into DNA
Researchers Encode Entire Book Into DNA

As Big Data grows and storage moves to the cloud, it's easy to forget that all that information still takes...

Hadoop and Disparate Data Stores
Hadoop and Disparate Data Stores

Through our experiences in working with customers on Big Data platforms, we’ve come to notice that there ar...


Subscribe to our Newsletter

Thank you!
Error - something went wrong!