解決sweetalert 無故報錯 elem.className.replace Uncaught TypeError: Cannot read property 'className' of null


今天碰到這么一個問題,在使用sweetalert的時候時有時無會報錯

 elem.className.replace Uncaught TypeError: Cannot read property 'className' of null

 很簡單,debug源碼,發現elem在有時候會為空,為空的時候拋出異常,修改如下代碼即可解決該問題

 效果:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM