今天碰到这么一个问题,在使用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. 软考历程(5)——extend 与 include

    软考中涉及扩展与包括关系的辨认,先不说考试的事,扩展与包括关系是UML中非经常见.非常基础的一种关系,然而我发现非常多同学都特别easy混淆,甚至软考真题中都存在题目和答案有待商榷的地方.此篇博客实属 ...

  2. linux tftp 服务

    TFTP(Trivial File Transfer Protocol)是基于UDP协议开发,用来在客户机与server之间进行简单文件传输的协议,提供不复杂.开销不大的文件传输服务. 一.改动/et ...

  3. log4j2的xml的配置样例

    log4j2.xml <?xml version="1.0" encoding="UTF-8"?> <Configuration status ...

  4. CSS中常见的长度单位

    原文地址:https://segmentfault.com/a/1190000008934791?utm_source=tuicool&utm_medium=referral px - 像素 ...

  5. Win10易升-在线升级工具

    Win7盗版激活,直接用win10官方推荐的工具在线升级W10直接升级为正版用户... 00.升级协议 11.兼容检测 22.工具下载 Window10官方在线升级工具:https://pan.bai ...

  6. 微信扫码支付springboot版本

    发布时间:2018-11-06   技术:springboot+freemarker   概述 该项目是一个采用springboot构建的web项目,主要实现了微信扫码支付功能.包含最基本的创建订单, ...

  7. org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session:

    保存实体异常 https://blog.csdn.net/zzzz3621/article/details/9776539 org.hibernate.NonUniqueObjectException ...

  8. clear session on close of browser jsp

    关闭浏览器销毁session <%@ Page Language="C#" AutoEventWireup="true" CodeBehind=" ...

  9. UICollectionView Demo

    1. 利用系统自动布局UICollectionViewFlowLayout进行布局. ViewController1 #import "ViewController1.h" @in ...

  10. React(0.13) 定义一个checked组件

    <!DOCTYPE html> <html> <head> <title>React JS</title> <script src=& ...