我有一个甜蜜的警报,上面有一个textarea,窗口在空格键按下时关闭。
swal({
title: 'Something Went Wrong',
text: '<textarea id="my-textarea" name="my-textarea" rows="5" />',
type: 'error',
showCancelButton: true,
confirmButtonText: 'Yes, Refresh Page',
confirmButtonClass: 'btn-danger',
html: true
}
我可以阻止此行为吗?
答案 0 :(得分:1)
我有同样的问题,我这样解决了: 如果你使用le min js,请在sweet-alert.min.js中检索这部分代码&#34; = n.keyCode || n.which,a = k(m,&#34; visible&#34 ;); if(-1!== [9,13 &#34;并删除下一个&#34; 32 &#34;在数组中重新删除ascii代码空格键。
答案 1 :(得分:0)
我有评论第388行,并且能够让窗口不关闭。
//fireClick($targetElement, e);