引导箱:使用ENTER键使默认按钮起作用吗? [英] Bootbox: Make the default button work with the ENTER key?

查看:57
本文介绍了引导箱:使用ENTER键使默认按钮起作用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所示,我想将Enter键添加为Bootbox.js的事件处理程序.调用alert()弹出窗口时,可以按Enter键将其关闭,但Bootbox.js并非如此.我不知道如何访问Bootbox.js中的按钮以添加事件处理程序.有什么建议么?

As the title suggests, I want to add the Enter key as an event handler for Bootbox.js. When you an alert() popup is called, you can press enter to dismiss it, but that is not the case with Bootbox.js. I do not know how to get access to the button inside Bootbox.js to add an event handler. Any suggestions?

推荐答案

为使按钮获得焦点,应使用"btn-primary"类名称对其进行定义:

In order for the button to take focus, it should be defined with the "btn-primary" class name:

className:
main: {
      className: "btn-primary",  ...
}

这篇关于引导箱:使用ENTER键使默认按钮起作用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆