Rhono Rhono - 1 year ago 79
Javascript Question

Delegated click event not firing on descendants

I have a view that is a

that has a method I want called whenever a
event happens on it or an

The view looks like this:

mySelect = Backbone.view.extend({
el: '.my-select',
events: {
'click': 'isSelected'
isSelected: function(e) {

only fires when I click on the
itself and not the

I've tried
'click option'
'click *'
, and
'click .my-select > option'

What am I missing?

Answer Source

What I'm trying to do isn't possible and the reason is entirely unrelated to Backbone! The problem is that in most browsers mouse/keyboard events do not fire on options.

From MDN:

Historically, Firefox has allowed keyboard and mouse events to bubble up from the element to the parent element. This doesn't happen in Chrome, however, although this behavior is inconsistent across many browsers.


The SO answer that led me to MDN: onclick on option tag not working on IE and chrome

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download