Browse Source

Update bootstrap-dialog.js

This adds possibility to define button's hot key that triggers action function when required keyCode is detected.
Andrew Ivaskevych 12 years ago
parent
commit
bc1e1446de
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;
             return $button;
         },
         },
         /**
         /**