Sweet alert closing on spacebar press.

不羁岁月 提交于 2019-12-12 18:18:58

问题


I have a sweet alert with a textarea on it, the window is closing on spacebar press.

 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
        }

Can I prevent this behaviour ?


回答1:


I had the same problem and i solved it like this : If you use le min js, retrieve this part of code in sweet-alert.min.js "=n.keyCode||n.which,a=k(m,"visible");if(-1!==[9,13" and remove the next "32" in the array which represant the ascii code of spacebar.




回答2:


I have comment line 388 and was able to have the window not closing.

//fireClick($targetElement, e);


来源:https://stackoverflow.com/questions/34684404/sweet-alert-closing-on-spacebar-press

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!