Mousetrap JS, how to bind numbers from 1 to 100?

91 Views Asked by At

Binding numbers from 1 to 100 causes problems when the sequence repeats as follows.

Mousetrap.bind("1", function(e) {alert(1);});
Mousetrap.bind("11", function(e) {alert(11);});

Only the first one works. Is there a way to bind all numbers from 1 to 100?

1

There are 1 best solutions below

0
On

Try this gist: https://gist.github.com/moos/22ee1584833de27f041c

  Mousetrap.bind('numbers', callback) // handle a sequence of 1+ numbers