今天碰到这么一个问题,在使用sweetalert的时候时有时无会报错

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

很简单,debug源码,发现elem在有时候会为空,为空的时候抛出异常,修改如下代码即可解决该问题

效果:

解决sweetalert 无故报错 elem.className.replace Uncaught TypeError: Cannot read property 'className' of null的更多相关文章

  1. Uncaught TypeError: Cannot set property 'onclick' of null解决办法

    如果把js内容直接放在这个head标签以内,button按钮不能正常点击更换body的背景颜色,报错提示:demo6.html:16 Uncaught TypeError: Cannot set pr ...

  2. Eclipse的Project Facets属性设置解决项目无故报错

    新检出项目,发现代码无故报错,各种尝试,最终发现是因为  项目右键中的 project Facets 属性中的 java 后面的 version 版本和项目 build path 的 jdk 版本不一 ...

  3. 前台报错:Uncaught TypeError: Cannot read property '0' of null

    错误现象: var div1=mycss[0].style.backgroundColor;  //这一行提示360和chrome提示:Uncaught TypeError: Cannot read  ...

  4. vue报错 Uncaught TypeError: Cannot read property ‘children ’ of null

    Uncaught TypeError: Cannot read property ‘children ’ of null ratings未渲染完毕,就跳走goods了,取消默认跳转,即可

  5. 解决Maven项目中的无故报错的方法

    解决Eclipse+maven中的无故报错 错误: One or more constraints have not been satisfied. Deployment Assembly跟java版 ...

  6. eclipse项目无故报错,markers信息为An error occurred while filtering resources

    eclipse项目无故报错,markers信息为An error occurred while filtering resources 描述:eclipse项目和resource文件上有红色的叉,其m ...

  7. 解决:MySQL 报错:1045 - Access denied for user 'root'@'localhost'(using password YES)

    一.前言 今年疯狂迷上了开源,只要看到好的开源项目,就会不顾一切一股脑扎进去研究,五一期间发现一个很好的关于众筹的开源项目,但不巧,这个项目竟然是 PHP 写的,没学过 PHP,自然对这个开源项目毫无 ...

  8. 解决kylin查询报错:org.apache.kylin.rest.exception.InternalErrorException

    报错信息: -- ::, ERROR [Query 12e9c054-760c---b1f06724c9b6-] service.QueryService: : Exception when exec ...

  9. homestead虚拟机,通过npm下载依赖包和解决运行gulp报错问题 yarn出错问题

    homestead虚拟机,通过npm下载依赖包和解决运行gulp报错问题 yarn出错问题 1. 在虚拟器运行 npm 下载依赖组件时报错: npm ERR! EPROTO: protocol err ...

随机推荐

  1. android N : UnsatisfiedLinkError 只能访问设置为公用库的so库

    在android N上使用 .so作为apk的第三方库的时候,会发生java.lang.UnsatisfiedLinkError: 09-27 12:17:01.280 D/ListenSoundMo ...

  2. cocos2d-js Shader系列2:在cc.Sprite上使用Shader(黑白、灰度、造旧效果)

    在Sprite中使用Shader做特殊的颜色处理比较简单,只需要把Shader程序绑定到Sprite上即可: sprite.shaderProgram = alphaTestShader; Cocos ...

  3. [Android]Recovery调用外部Shell脚本,Shell脚本使用ui_print方法

    busybox_bin=/sbin/busybox # 获取PIPE get_outfd(){ | $busybox_bin grep -q 'pipe'; then else local all_p ...

  4. 双足步行机器人的ZMP与CoP检测

    静态步行与动态步行 机器人步态分为静态步行和动态步行.当机器人做静态步行运动时,身体的各个部分运动速度很小,机器人的整体稳定性较易控制.静态步行稳定性采用机器人的重心地面投影点(Center of G ...

  5. JUC-Condition和Lock实践-线程按序交替执行

    编写一个程序,开启 3 个线程,这三个线程的 ID 分别为 A.B.C,每个线程将自己的 ID 在屏幕上打印 10 遍,要求输出的结果必须按顺序显示.如:ABCABCABC…… 依次递归 这里只使用c ...

  6. Fix problems that block programs from being installed or removed

    Follow these steps to automatically repair issues including corrupted registry keys that block you f ...

  7. (原+译)pytorch中保存和载入模型

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/8108466.html 参考网址: http://pytorch.org/docs/master/not ...

  8. Spring中Autowired注解,Resource注解和xml default-autowire工作方式异同

    前面说到了关于在xml中有提供default-autowire的配置信息,从spring 2.5开始,spring又提供了一个Autowired以及javaEE中标准的Resource注释,都好像可以 ...

  9. Storage System and File System Courses

    I researched a lot about storage system classes given at good universities this year. This had two r ...

  10. 【LeetCode】Missing Ranges

    Missing Ranges Given a sorted integer array where the range of elements are [lower, upper] inclusive ...