jQuery.js Archives - Thoughts https://blog.jstassen.com/tag/jquery-js/ A place for collecting my miscellaneous thoughts. Wed, 25 Oct 2017 17:07:36 +0000 en-US hourly 1 https://wordpress.org/?v=7.0.7 92836340 Code: Backbone.js Selecting Elements with jQuery https://blog.jstassen.com/2014/09/code-backbone-js-selecting-elements-jquery/ https://blog.jstassen.com/2014/09/code-backbone-js-selecting-elements-jquery/#respond Thu, 18 Sep 2014 15:35:31 +0000 http://blog.jstassen.com/?p=461 Found a very simple way to get a jQuery rapped DOM element that is within a subView in Backbone. using `this.$( )`. This is pretty handy because it traverses only DOM elements within the current view instead of the entire DOM tree. Inside a backbone view: this.$('.myElement') Inside an event this.$('.myElement') or $(argument1.currentEvent).find('.myElement') Inside a Model … Continue reading Code: Backbone.js Selecting Elements with jQuery →

The post Code: Backbone.js Selecting Elements with jQuery appeared first on Thoughts.

]]>
Found a very simple way to get a jQuery rapped DOM element that is within a subView in Backbone. using `this.$( )`. This is pretty handy because it traverses only DOM elements within the current view instead of the entire DOM tree.

Inside a backbone view:

this.$('.myElement')

Inside an event

this.$('.myElement') or $(argument1.currentEvent).find('.myElement')

Inside a Model / Collection:

You shouldn’t, that’s the View’s responsibility

The post Code: Backbone.js Selecting Elements with jQuery appeared first on Thoughts.

]]>
https://blog.jstassen.com/2014/09/code-backbone-js-selecting-elements-jquery/feed/ 0 461