'Backbone selector beginning with like in JQuery

In jQuery, if we want to get element beginning with, we would use ^= selector. For, example:

$("input[id^='edit-']").click()

Benefit is we can easily get dynamic element with ids like edit-234. In Backbone, I have tried this:

var MyView = Backbone.View.extend({
  events: {
    "click input[id^='edit-']": "edit",
  },
});

But it didn't work. Is there any workaround?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source