nakhli
nakhli

Reputation: 4059

Backbone js: register view events on parent element

I'd like to register view events on the view parent element. I tried the parent selector:

var MyView = Backbone.View.extend({
  events: {
    'mousemove :parent': 'mousemove'
  },
  // ...
});

But it is not working. How can I achieve this?

Upvotes: 0

Views: 1044

Answers (1)

LeoDT
LeoDT

Reputation: 80

Backbone uses jQuery event delegate, so you can't delegate events to the parent node.

see in Backbone source code line 954, the View.delegateEvents function.

Upvotes: 3

Related Questions