Backbone Views Scoped Queries

Like Dave Brailsford, I’m a fan of marginal gains and love discovering small tips and tricks to optimise my development workflow. So in the spirit of marginal gains, here’s a tiny productivity tip for Backbone.js that I stumbled upon the the other day.

If you have jQuery included and need to target a child of your view’s el, instead of this…


You can just write…


BOOM. milliseconds of typing time saved.

Every Backbone view has a $ function that runs scoped queries within the view’s el. Probably obvious to most as it’s right there in the docs, but I only just noticed it so am recording it here as an aide memoir.

Leave a Reply