Search code examples
backbone-events

Bind backbone event to a multiple class selector


I can't get the following event to attach to my element.

events = {
   "change .date-selector .date-range": "dateRangeSelectionChanged"
}

Is this supported at all in Backbone.js? Or am I using a wrong syntax?


Solution

  • To select upon multiple classes you should use:

    events = { "change .date-selector.date-range": "dateRangeSelectionChanged" }
    

    Note the removed space between classes