var self = this;
/* bind buttons */
- $('button[data-ui-action]', self.$elem).click(function(event) {
- event.preventDefault();
-
+ function dataUiAction(elem) {
var action = $(this).attr('data-ui-action');
console.log("Button pressed, action: ", action);
if(action == 'cancel')
self.hide();
}
+ }
+ $('button[data-ui-action]', self.$elem).click(function(event) {
+ event.preventDefault();
+ dataUiAction(this);
+ }).on('keydown'), function(event) {
+ if (event.key == 'Enter') {
+ event.preventDefault();
+ dataUiAction(this);
+ }
});
}