问题 :Uncaught TypeError: Cannot read property ‘split’ of undefined
at HTMLLIElement.

split()切割的问题 因为遍历ul的时候,第一次会得到一个空值,这个是通过输出遍历的对象知道的,最后我在使用split()的时候加了一个判断(就是判断要切割的字符串是不是存在)

$(".type_ul").find('li').each(function () {
var zhi=$(this).find('a').attr("href");
if (zhi) {
var qwe=zhi.split('.')[0];
console.log(qwe);
}
})

Uncaught TypeError: Cannot read property ‘split’ of undefined的更多相关文章

  1. index.js:13 Uncaught TypeError: Cannot read property 'split' of undefined

    使用 webpack 编译 Vue 项目时出现报错: index.js:13 Uncaught TypeError: Cannot read property 'split' of undefined ...

  2. Uncaught TypeError: Cannot read property 'msie' of undefined

    因为图方便,抄了别人写的一个jquerry插件,运行时“var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ...

  3. easyui使用时出现这个Uncaught TypeError: Cannot read property 'combo' of undefined

    easyui使用时出现这个Uncaught TypeError: Cannot read property 'nodeName' of undefined 最后检查发现是必须给select一个id,光 ...

  4. reactjs Uncaught TypeError: Cannot read property 'location' of undefined

    reactjs Uncaught TypeError: Cannot read property 'location' of undefined reactjs 路由配置 怎么跳转 不成功 国内搜索引 ...

  5. SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论 SignalR 简单示例 通过三个DEMO学会SignalR的三种实现方式 SignalR推送框架两个项目永久连接通讯使用 SignalR 集线器简单实例2 用SignalR创建实时永久长连接异步网络应用程序

    SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论   异常汇总:http://www ...

  6. DataTable插件报错:Uncaught TypeError: Cannot read property 'style' of undefined

    DataTable插件报错:Uncaught TypeError: Cannot read property 'style' of undefined 原因:table 中定义的列和aoColumns ...

  7. activiti5.22整合modeler时出错TypeError: Cannot read property 'split' of undefined

    activiti5.22.0整合modeler时,打开的流程页面不显示工具栏和左边的控件栏,产生如下的错误: TypeError: Cannot read property 'split' of un ...

  8. underscore.js定义模板遇到问题:Uncaught TypeError: Cannot read property 'replace' of undefined

    代码正确缩进位置如下, extend "layout" block 'content',-> div ->'nihao' script id:"Invoice ...

  9. Uncaught TypeError: Cannot read property 'decimalSeparator' of undefined

    1.错误描述 jquery.jqGrid.min.js:477 Uncaught TypeError: Cannot read property 'decimalSeparator' of undef ...

随机推荐

  1. redis 连接idea一直被拒绝

    网上查找的方法 方法一:idea中已经下载了Iedis 插件, 也导入了jar包 <!-- https://mvnrepository.com/artifact/commons-pool/com ...

  2. 空数组判断false、true的情况

  3. MDS

    转载:https://blog.csdn.net/victoriaw/article/details/78500894 多维缩放(Multidimensional Scaling, MDS)是一组对象 ...

  4. 网路知识总结(session&&Cookie&&三次握手&&请求头)

    1. 请说明Session和Cookie的作用和区别 1) Cookie 存在前端 前端需要拿着cookie访问后端,Session在服务器上(文件,数据库,如Redis) 2) web访问Serve ...

  5. 使用diff或者vimdiff比较远程文件(夹)与本地文件夹

    方法1:管道给diff $ssh eric@192.168.1.11 "cat ~/remote_file.txt" | diff - ~/local_file.txt 如果 Fi ...

  6. Linux环境配置错误记录

    1.  pip install --special_version  pip10. 版本. 使用命令: python -m pip install pip== 其中, -m 参数的意思是将库中的pyt ...

  7. CTF--web 攻防世界web题 get_post

    攻防世界web题 get_post https://adworld.xctf.org.cn/task/answer?type=web&number=3&grade=0&id=5 ...

  8. 浅谈Kubernetes生产架构

    注意本文,只是笔者针对Kubernetes生产环境运行的一些关于架构设计和实现方案的总结,内容很粗糙,同时也会不断完善. 首先,我们来梳理下Kubernetes生产架构,其设计适用于绝大多数环境.如下 ...

  9. python之路(4)高阶函数和python内置函数

    前言 函数式编程不用变量保存状态,不改变变量 内置函数 高阶函数 把函数当作参数传给另一个对象 返回值中包含函数 使用的场景演示: num_test = [1,2,10,5,8,7] 客户说 :对上述 ...

  10. Matplotlib图例

    折线图示例 #!/usr/bin/python2.7 import numpy as np from matplotlib import pyplot as plt from dbtools impo ...