Friday, 6 September 2013

Backbone select change event not firing

Backbone select change event not firing

I have a view which defines a change event on some select controls, but
they don't seem to be firing. The view is something like this:
var FiltersView = Backbone.Marionette.ItemView.extend({
template: FiltersTmpl,
events: {
'change #panel_filters select': 'enableSearch'
},
enableSearch: function() {
debugger;
}
});
When I change the dropdown, enableSearch doesn't fire. However, using
Chrome Dev Tools, I can use jQuery to setup an event handler like this
$("#panel_filters select").change(function() { debugger; }); and that does
in fact fire. So I know the selector is correct and the select is
triggering a change event. I know it must be a simple syntax problem but
it seems like the correct syntax to me.

No comments:

Post a Comment