ソースを参照

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 年 前
コミット
bc1e1446de
1 ファイル変更9 行追加0 行削除
  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;
         },
         /**