Browse Source

Merge pull request #7 from AndrewEastwood/patch-1

Button hotkey supported.
nakupanda 12 years ago
parent
commit
d0757cf447
1 changed files with 9 additions and 0 deletions
  1. 9 0
      js/bootstrap-dialog.js

+ 9 - 0
js/bootstrap-dialog.js

@@ -432,6 +432,15 @@ var BootstrapDialog = null;
                 }
             });
 
+            // Button hotKey
+            if (button.hotKey)
+                this.getModalDialog().on('keypress', function(event){
+                    if (!event || !event.which)
+                        return;
+                    if (event.which === button.hotKey)
+                        $button.trigger('click');
+                });
+
             return $button;
         },
         /**