jQuery on(); function

javascript, jquery

Solution

`this.render()` executes function (so in your case you are passing data returned from this function), whereas `this.render` is handler to function.

Problem

I'm learning Backbone and had some issues with the on()-function. But actually it's a very basic JavaScript question. Why is it that the first line of code below works, and the second doesn't? Using the second line, the render-function is never triggered. Mind the brackets. Works ``` this.collection.on( 'reset', this.render, this ); ``` Fails ``` this.collection.on( 'reset', this.render(), this ); ```

Original source

Related problems