Does keypress events not apply to Backbone.js Views

backbone.js, events, keypress

Solution

In addition to the question @rkw linked You might want to have a look at this SO question Why audio events are not firing with BackboneJS but others are?

Basically backbone.js uses delegation to bind events, which only works with delegate-able events.

You can bind to the keypress manually in the initializer

 initialize: function () {
        _.bindAll(this);
          $(document).bind('keyup', this.navigate);
    },

Problem

I don't understand if anything is wrong in this idea but the Backbone Views just don't trigger keypress, keyup events. I have created a simple shopping list app is JsBin for you to inspect. In the chrome inspector the `ul` of the view shows the keyup event but it does not occur when i hit some keys in the keyboard. I need the idea to navigate Treeview using the keyboard events Jsbin http://jsbin.com/arucom/2/edit

Original source

Related problems